From: Tom Lane <tgl@sss.pgh.pa.us>
To: 'Gary Stainburn' <gary.stainburn@ringways.co.uk>
Cc: 'Pgsql Interfaces' <pgsql-interfaces@postgreSQL.org>
Subject: Re: [INTERFACES] locking on database updates
Date: Tue, 07 Dec 1999 12:45:35 -0500
Message-ID: <23883.944588735@sss.pgh.pa.us> (raw)
In-Reply-To: <01BF40E0.9C3B30C0@agen.int.ghs>
> 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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-interfaces@postgresql.org
Cc: tgl@sss.pgh.pa.us, gary.stainburn@ringways.co.uk
Subject: Re: [INTERFACES] locking on database updates
In-Reply-To: <23883.944588735@sss.pgh.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox