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@gmx.net 75262 Uppsala
http://yi.org/peter-e/ Sweden