On Thu, Feb 19, 2004 at 07:16:42PM +0100, Alexander Troppmann wrote: > SELECT SETVAL('recipe_id_seq', max(id)) FROM recipe; > > returns the following output: > > setval > -------- > 455 > (1 row)
Ok. > Now I tried to fetch the next free primary key id for my "recipe" table: > > SELECT NEXTVAL('recipe_id_seq') FROM receipt; You're going to get a value for every row in receipt, which is what you're seeing. What you want is SELECT NEXTVAL( 'recipe_id_seq'); --Joe -- Joe Sunday <[EMAIL PROTECTED]> http://www.csh.rit.edu/~sunday/ Computer Science House, Rochester Inst. Of Technology ---------------------------(end of broadcast)--------------------------- TIP 8: explain analyze is your friend