Re: getting oid of an INSERT automatically - Mailing list pgsql-sql

From Oliver Elphick
Subject Re: getting oid of an INSERT automatically
Date
Msg-id 1028813335.31323.50.camel@linda
Whole thread Raw
In response to getting oid of an INSERT automatically  ("John Brothers" <johnbr@undefined.com>)
List pgsql-sql
On Wed, 2002-08-07 at 19:39, John Brothers wrote:
> Hello all,
> 
>    In pgplsql, is there any way to get the oid that is returned from an INSERT statement, without
> doing a 'follow-up' SELECT for the oid?

From the Programmers' Guide (PL/pgSQL section):
   23.5.5. Obtaining result status      GET DIAGNOSTICS variable = item [ , ... ] ;      This command allows retrieval
ofsystem status indicators. Each item   is a keyword identifying a state value to be assigned to the   specified
variable(which should be of the right data type to   receive it). The currently available status items are ROW_COUNT,
the  number of rows processed by the last SQL query sent down to the SQL   engine; and RESULT_OID, the Oid of the last
rowinserted by the most   recent SQL query. Note that RESULT_OID is only useful after an   INSERT query.    
 
-- 
Oliver Elphick                                Oliver.Elphick@lfix.co.uk
Isle of Wight, UK                            
http://www.lfix.co.uk/oliver
GPG: 1024D/3E1D0C1C: CA12 09E0 E8D5 8870 5839  932A 614D 4C34 3E1D 0C1C
========================================   "Ye lust, and have not; ye kill, and desire to have,      and cannot obtain;
yefight and war, yet ye have not,      because ye ask not."            James 4:2 
 



pgsql-sql by date:

Previous
From: Frank Joerdens
Date:
Subject: Re: to_char and '=' weirdness
Next
From: Tom Lane
Date:
Subject: Re: manipulating the POINT data type