On Wed, Mar 03, 2004 at 06:45:56AM +0100, Paulovi?? Michal wrote: > Yes I know, > > But how you do this at PgSQL????
You have to lock the table exclusively, get the max value for your particular "id1", increment it, insert the row, and commit: begin; lock table test in exclusive mode; insert into test values (1,(select max(id2) from test where id1=1)+1); commit; It's not pretty, and it'll probably slow down as the table grows. MySQL probably suffers the same problem. Michael -- Michael Darrin Chaney [EMAIL PROTECTED] http://www.michaelchaney.com/ ---------------------------(end of broadcast)--------------------------- TIP 7: don't forget to increase your free space map settings