Re: [INTERFACES] locking on database updates - Mailing list pgsql-interfaces

From Tom Lane
Subject Re: [INTERFACES] locking on database updates
Date
Msg-id 23883.944588735@sss.pgh.pa.us
Whole thread Raw
In response to RE: [INTERFACES] locking on database updates  (Nicolas Huillard <nhuillard@ghs.fr>)
List pgsql-interfaces
> The problem is that this does not actually give me the number that
> was just created.  As there is no guarantee that the other fields in
> the table are unique (hence the serial field in the first place) I cannot
> simply do a select to retrieve it.

Easiest answer is to do
SELECT nextval('sequence_object');

and then INSERT the new row into your table using the value you just
obtained as an explicit value for the ID column, thus overriding the
default expression.
        regards, tom lane


pgsql-interfaces by date:

Previous
From: Nicolas Huillard
Date:
Subject: RE: [INTERFACES] locking on database updates
Next
From: Tom Lane
Date:
Subject: Re: [INTERFACES] locking on database updates