fetching the id of a new row - Mailing list pgsql-sql

From Jelle Ouwerkerk
Subject fetching the id of a new row
Date
Msg-id Pine.NEB.4.10.10102081613240.3543-100000@what.openface.ca
Whole thread Raw
Responses Re: fetching the id of a new row  ("Albert REINER" <areiner@tph.tuwien.ac.at>)
List pgsql-sql
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





pgsql-sql by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] PL/pgsql EXECUTE 'SELECT INTO ...'
Next
From: Stephan Szabo
Date:
Subject: Re: parse error in create index