From: | Keary Suska <hierophant(at)pcisys(dot)net> |
---|---|
To: | Postgres-Interfaces <pgsql-interfaces(at)postgresql(dot)org> |
Subject: | Re: FW: Libpq and the SQL RETURNING clause |
Date: | 2008-08-27 23:31:57 |
Message-ID: | C4DB400D.2870F%hierophant@pcisys.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-interfaces |
8/27/08 8:28 AM, also sprach Georges(dot)Brefort(at)sanofi-aventis(dot)com:
>
>
> ________________________________
>
> From: Brefort, Georges R&D/FR
> Sent: Tuesday, August 26, 2008 2:41 PM
> To: pgsql-interfaces(at)postgresql(dot)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"
From | Date | Subject | |
---|---|---|---|
Next Message | Nat! | 2008-09-15 10:38:19 | Async processing of rows |
Previous Message | Georges.Brefort | 2008-08-27 14:28:29 | FW: Libpq and the SQL RETURNING clause |