Re: [HACKERS] Get OID of just inserted record
От | Peter Eisentraut |
---|---|
Тема | Re: [HACKERS] Get OID of just inserted record |
Дата | |
Msg-id | Pine.LNX.4.20.9911022225200.356-100000@peter-e.yi.org обсуждение исходный текст |
Ответ на | Re: [HACKERS] Get OID of just inserted record ("Aaron J. Seigo" <aaron@gtv.ca>) |
Список | pgsql-hackers |
On Nov 2, Aaron J. Seigo mentioned: > > => 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 You can access it right there :) How exactly do you wish to access it in psql though? (I'm writing around in psql at the moment, so I might actually implement it!) > instance, default values in tables that are generated dynamically... etc Well, now you're saying "I want all this complex data from the database but I don't want to use SELECT". That does make much sense. The point of defaults is that you don't need to worry about them. If you need to read back a record right after you insert it, perhaps you should rethink your application. Admittedly, I know of several interfaces that make this sort of thing a royal pain, but you can't get everything for free. -- Peter Eisentraut Sernanders vaeg 10:115 peter_e@gmx.net 75262 Uppsala http://yi.org/peter-e/ Sweden
В списке pgsql-hackers по дате отправления: