Re: SERIAL behaviour - Mailing list pgsql-general

From Martijn van Oosterhout
Subject Re: SERIAL behaviour
Date
Msg-id 20020716000712.A21882@svana.org
Whole thread Raw
In response to Re: SERIAL behaviour  (Adrian 'Dagurashibanipal' von Bidder <avbidder@fortytwo.ch>)
Responses Re: SERIAL behaviour  (Adrian 'Dagurashibanipal' von Bidder <avbidder@fortytwo.ch>)
List pgsql-general
On Mon, Jul 15, 2002 at 03:47:28PM +0200, Adrian 'Dagurashibanipal' von Bidder wrote:
> On Sun, 2002-07-14 at 03:59, Eugene wrote:
> [ SERIAL type / SEQUENCEs and transactions ]
>
> Closely related: what's the official/preferred way if I'm inserting rows
> into a table with a auto assigned id (SERIAL), to get the newly created
> id? asking the sequence obviously will not work - as the sequence will
> advance when the next value is inserted from another transaction.

You read the documentation and notice that currval() is not affected by
nextval()s executed upon other connections. In other words, it's a complete
non-issue and works exectly the way that is useful.
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> There are 10 kinds of people in the world, those that can do binary
> arithmetic and those that can't.

pgsql-general by date:

Previous
From: Steve Brett
Date:
Subject: Re: SERIAL behaviour
Next
From: Jim Caley
Date:
Subject: Re: PostgreSQL included in ZDNet article...