Re: Getting Primary Key Value After Insert - Mailing list pgsql-general

From Greg Stark
Subject Re: Getting Primary Key Value After Insert
Date
Msg-id 8764i7l4ab.fsf@stark.xeocode.com
Whole thread Raw
In response to Re: Getting Primary Key Value After Insert  (Richard Broersma Jr <rabroersma@yahoo.com>)
Responses Re: Getting Primary Key Value After Insert  (Richard Broersma Jr <rabroersma@yahoo.com>)
List pgsql-general
Richard Broersma Jr <rabroersma@yahoo.com> writes:

> > 3.  If you call currval() will it return 20?  I would think it does.

Yes it does.

> My understanding is that it will provided your are within a transaction.

As long as you're in the same session you're fine. You would have to go out of
your way to break it but if you're using some sort of connection pooling you
wouldn't want to pull a fresh connection from the pool, for example.

--
greg

pgsql-general by date:

Previous
From: Michael Glaesemann
Date:
Subject: Re: Is OpenFTS dead?
Next
From: Richard Broersma Jr
Date:
Subject: Re: Getting Primary Key Value After Insert