Re: SERIAL behaviour

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Adrian 'Dagurashibanipal' von Bidder <avbidder(at)fortytwo(dot)ch>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: SERIAL behaviour
Date: 2002-07-15 14:07:12
Message-ID: 20020716000712.A21882@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)svana(dot)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.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Jim Caley 2002-07-15 14:08:27 Re: PostgreSQL included in ZDNet article...
Previous Message Steve Brett 2002-07-15 13:59:28 Re: SERIAL behaviour