From: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
---|---|
To: | "Aaron J(dot) Seigo" <aaron(at)gtv(dot)ca> |
Cc: | Peter Eisentraut <e99re41(at)DoCS(dot)UU(dot)SE>, pgsql-hackers(at)postgresql(dot)org |
Subject: | Re: [HACKERS] Get OID of just inserted record |
Date: | 1999-11-02 21:29:00 |
Message-ID: | Pine.LNX.4.20.9911022225200.356-100000@peter-e.yi.org |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)gmx(dot)net 75262 Uppsala
http://yi.org/peter-e/ Sweden
From | Date | Subject | |
---|---|---|---|
Next Message | Tyson Oswald | 1999-11-02 23:17:42 | selecting a certain number of rows |
Previous Message | Dimitri | 1999-11-02 20:31:59 | Re: PostgreSQL vs Mysql comparison |