Re: SQL-question: returning the id of an insert querry

From: Scott Chapman <scott_list(at)mischko(dot)com>
To: Martijn van Oosterhout <kleptog(at)svana(dot)org>, Andreas Fromm <Andreas(dot)Fromm(at)physik(dot)uni-erlangen(dot)de>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: SQL-question: returning the id of an insert querry
Date: 2003-11-09 18:26:51
Message-ID: 200311091026.51404.scott_list@mischko.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sunday 09 November 2003 03:13, Martijn van Oosterhout wrote:
> After you've done the insert on the address table, you can use
> currval('address_id_seq') (or equivalent) to get the ID. Ofcourse you
> have to have used nextval() for the original insert.

What if someone else inserts another address before I get the currval?
I'm out of luck then, right?

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Doug McNaught 2003-11-09 18:38:16 Re: SQL-question: returning the id of an insert querry
Previous Message Alex 2003-11-09 15:06:12 Question on Select