From: Jelle Ouwerkerk <jelle@openface.ca>
To: pgsql-sql@postgresql.org
Subject: fetching the id of a new row
Date: Thu, 8 Feb 2001 17:28:59 -0500 (EST)
Message-ID: <Pine.NEB.4.10.10102081613240.3543-100000@what.openface.ca> (raw)
Hi,
How might I insert a new row into a table and return the id of the new row
all in the same SQL statement? The id is generated by a sequence. Up to
now I've been getting the nextval of the sequence first and then inserting
with the id in a second SQL exec. Is there a faster way (in a general
case, without writing SQL or plpgsql functions)?
Thanks
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 from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: jelle@openface.ca
Subject: Re: fetching the id of a new row
In-Reply-To: <Pine.NEB.4.10.10102081613240.3543-100000@what.openface.ca>
References: <Pine.NEB.4.10.10102081613240.3543-100000@what.openface.ca>
* 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