Re: [HACKERS] How to get OID from INSERT in PL/PGSQL?
От | Peter Eisentraut |
---|---|
Тема | Re: [HACKERS] How to get OID from INSERT in PL/PGSQL? |
Дата | |
Msg-id | Pine.LNX.4.20.9911292245430.658-100000@localhost.localdomain обсуждение исходный текст |
Ответ на | [HACKERS] How to get OID from INSERT in PL/PGSQL? (Ed Loehr <ELOEHR@austin.rr.com>) |
Список | 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@gmx.net 75262 Uppsala http://yi.org/peter-e/ Sweden
В списке pgsql-hackers по дате отправления: