From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | Ed Loehr <ELOEHR(at)austin(dot)rr(dot)com> |
Cc: | pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [HACKERS] How to get OID from INSERT in PL/PGSQL? |
Date: | 1999-11-30 00:03:50 |
Message-ID: | Pine.LNX.4.20.9911292245430.658-100000@localhost.localdomain |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On 1999-11-28, Ed Loehr mentioned:
> Is it possible to programmatically retrieve the OID of a just-inserted
> record in a PL/PGSQL function? Apparently, it is not currently
> possible in psql, but I'm hoping C programming is not required for
> this.
For what it's worth, psql will be able to do this in the next release. It
will look like this:
=> insert into foo values (...);
=> insert into bar values (:LastOid, ...);
which is even marginally SQL compliant as I understand. If you are daring
you can get the current snapshot and try it, but I wouldn't sign my life
away on it quite yet.
> Bruce Momjian says its possible for things using libpq "directly" to
> retrieve the oid. Does PL/PGSQL use libpq directly?
Everything(?) uses libpq more or less directly. It's just a matter of
interfacing your applicaton to the OidStatus function. The above psql does
just that.
--
Peter Eisentraut Sernanders väg 10:115
peter_e(at)gmx(dot)net 75262 Uppsala
http://yi.org/peter-e/ Sweden
From | Date | Subject | |
---|---|---|---|
Next Message | Peter Eisentraut | 1999-11-30 00:05:00 | Portability (was Re: [HACKERS] Development installation fails) |
Previous Message | Uncle George | 1999-11-29 23:54:47 | Re: [PORTS] Re: [HACKERS] RedHat6.0 & Alpha |