Re: [HACKERS] Get OID of just inserted record

From: "Aaron J(dot) Seigo" <aaron(at)gtv(dot)ca>
To: Peter Eisentraut <peter_e(at)gmx(dot)net>, Peter Eisentraut <e99re41(at)DoCS(dot)UU(dot)SE>
Cc: pgsql-hackers(at)postgreSQL(dot)org
Subject: Re: [HACKERS] Get OID of just inserted record
Date: 1999-11-02 19:39:54
Message-ID: 99110212405605.28375@stilborne
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Dimitri 1999-11-02 20:31:59 Re: PostgreSQL vs Mysql comparison
Previous Message Tom Lane 1999-11-02 19:20:05 Re: [HACKERS] file descriptors leak?