From: Keary Suska <hierophant@pcisys.net>
To: Postgres-Interfaces <pgsql-interfaces@postgresql.org>
Subject: Re: FW: Libpq and the SQL RETURNING clause
Date: Wed, 27 Aug 2008 17:31:57 -0600
Message-ID: <C4DB400D.2870F%hierophant@pcisys.net> (raw)
In-Reply-To: <AC1B5B770E3FD54A94DED61FA96B12C3C9F196@CLPW44.f2.enterprise>
8/27/08 8:28 AM, also sprach Georges.Brefort@sanofi-aventis.com:
>
>
> ________________________________
>
> From: Brefort, Georges R&D/FR
> Sent: Tuesday, August 26, 2008 2:41 PM
> To: pgsql-interfaces@postgresql.org
> Subject: Libpq and the SQL RETURNING clause
>
>
> Dear Postgres specialist,
>
> 1 Assume you have a table such as the following:
>
> CREATE TABLE example( id SERIAL, someData VARCHAR(32) );
>
> 2 Now, you use a SQL statement to insert the data and get the the id
> value back:
>
> INSERT INTO example( someData ) VALUES( 'BlaBlaBla' ) RETURNING id;
>
> I wonder if it is possible to retrieve the value of the id field in an
> application using the C libpq library.
Yes. I do it all the time. Simply treat the result as if it was from a
select statement.
HTH,
Keary Suska
Esoteritech, Inc.
"Demystifying technology for your home or business"
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: hierophant@pcisys.net
Subject: Re: FW: Libpq and the SQL RETURNING clause
In-Reply-To: <C4DB400D.2870F%hierophant@pcisys.net>
* 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