On Tue, March 6, 2007 14:58, Bart Samwel wrote:
> Jim Stewart wrote:

>> 1) Is it possible to obtain the ID of a row inserted via a prepared
>> statement?
>
> Try using the syntax "returning", i.e.:

> This syntax is supported by PostgreSQL 8.2 and up, it was added in one
> of the more recent SQL standards. The trick also works for UPDATE
> statements AFAIK, and you can even do DELETE...RETURNING to return ids
> of the records you deleted.

Bart, you're right.  Before I sent out my own reply I did a quick check
for this syntax on a local database, and it wasn't supported.  But I
missed the fact that my local database was still running on 8.1.  Yes,
RETURNING is definitely the way to go.


Jeroen


_______________________________________________
Libpqxx-general mailing list
Libpqxx-general@gborg.postgresql.org
http://gborg.postgresql.org/mailman/listinfo/libpqxx-general

Reply via email to