Re: LAST_INSERT_ID equivalent - Mailing list pgsql-general

From Bruno Wolff III
Subject Re: LAST_INSERT_ID equivalent
Date
Msg-id 20030612192653.GA5756@wolff.to
Whole thread Raw
In response to Re: LAST_INSERT_ID equivalent  (Erik Price <eprice@ptc.com>)
List pgsql-general
On Thu, Jun 12, 2003 at 15:17:22 -0400,
  Erik Price <eprice@ptc.com> wrote:
>
> So you're saying that you perform a pre-query to fetch the nextval, then
> you include that in your query where you perform the INSERT?  I see.
> Since this is all part of the same transaction, the nextval value won't
> overwrite another simultaneous INSERT, I assume.  This seems like a good
> way to do it too.  I don't mind the holes in the sequence, but wouldn't
> this INSERT cause the sequence to increment the primary key yet again?

If you do things that way you specify a value for the serial column
rather than let it default to using nextval.

pgsql-general by date:

Previous
From: Steve Crawford
Date:
Subject: Re: need a method to ping a running database
Next
From: Ericson Smith
Date:
Subject: Re: LAST_INSERT_ID equivalent