how you solve the problem with multilevel autoicrement?

In MySQL you create table with col1, col2. Col 2 is AUTOICREMENT and you have to create UNIQUE INDEX (Col1, Col2). If you insert to this table for col1 volume 1, col2 automaticaly increase by one.

Example:
Insert into table values (1);
Insert into table values (1);
Insert into table values (2);
Insert into table values (1);
Insert into table values (2);

Result is:
1,1
1,2
2,1
1,3
2,2

How you convert this functionality from MySQL to PgSQL???


-------------------------------------- Bruce Momjian wrote:

Michael Chaney wrote:


One other note, for those converting a database from MySQL to
PostgreSQL, I have a table creation conversion script here:

http://www.michaelchaney.com/downloads/m2p.pl

I know that two come with PostgreSQL in the contrib directory, but I
wrote this because those two didn't do what I needed. With this, you
should be able to take the MySQL table creation scripts (as created by
mysqldump --tab=x) and directly build the tables and load the data into
a PostgreSQL db with little effort.



Please share what yours does that the /contrib doesn't, and ideally, send in a patch or let us add your version to /contrib.





---------------------------(end of broadcast)---------------------------
TIP 9: the planner will ignore your desire to choose an index scan if your
     joining column's datatypes do not match

Reply via email to