Re: [HACKERS] Get OID of just inserted record - Mailing list pgsql-hackers

From Aaron J. Seigo
Subject Re: [HACKERS] Get OID of just inserted record
Date
Msg-id 99110212405605.28375@stilborne
Whole thread Raw
In response to Re: [HACKERS] Get OID of just inserted record  (Peter Eisentraut <e99re41@DoCS.UU.SE>)
Responses Re: [HACKERS] Get OID of just inserted record  (Peter Eisentraut <peter_e@gmx.net>)
Re: [HACKERS] Get OID of just inserted record  (wieck@debis.com (Jan Wieck))
Re: [HACKERS] Get OID of just inserted record  ("D'Arcy" "J.M." Cain <darcy@druid.net>)
List pgsql-hackers
hi...

> > i could see where this would be useful in many different circumstances.. i
> > know this isn't standards compliant, but would be very cool =) i know that with
> > triggers, you have access to the current/old/new information, could this be
> > harnessed to supply a RETURN facility?
> 
> I'm not sure what I'm missing here:
> 
> => insert into foo values (4, 'aaa');
> INSERT 7998067 1
> 
> This line is generated by libpq's PQcmdStatus(). You can also just get the
> oid part by using PQoidStatus(). Is that what you wanted or do you need a
> wrapper or binding for a certain environment?
> 
>     -Peter

this assumes that one is using libpq.. it would be nice to have access to this
from psql or anywhere for that matter.. and not just oids.. but, say for
instance, default values in tables that are generated dynamically... etc

-- 
Aaron J. Seigo
Sys Admin


pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: [HACKERS] file descriptors leak?
Next
From: Peter Eisentraut
Date:
Subject: Re: [HACKERS] Get OID of just inserted record