Re: [HACKERS] Get OID of just inserted record

From: wieck(at)debis(dot)com (Jan Wieck)
To: aaron(at)gtv(dot)ca (Aaron J(dot) Seigo)
Cc: peter_e(at)gmx(dot)net, 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-03 01:10:28
Message-ID: m11iowW-0003kLC@orion.SAPserv.Hamburg.dsh.de
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Aaron J. Seigo wrote:

> > 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
> instance, default values in tables that are generated dynamically... etc

Where should I place the information about the final queries
the rule system changed the original one into? During
rewrite, one INSERT could be rewritten into several
different, conditional INSERT, UPDATE and DELETE statements.
I think this would be of interest for you too!

I'm not serious right now (as the ppl knowing me should have
seen already between the lines). I can see the point of
getting the last inserted OID, but I absolutely don't see it
on something like generated default values or the like. This
would finally mean, that an INSERT returns a result set of
the values it inserted. And the same then must happen (to be
consistent) for UPDATE and DELETE statements, where the
UPDATE returns pairs of OLD/NEW rows and DELETE reports which
rows got deleted. All this data has to be sent to the client
(to be thrown away usually).

Jan

--

#======================================================================#
# It's easier to get forgiveness for being wrong than for being right. #
# Let's break this rule - forgive me. #
#========================================= wieck(at)debis(dot)com (Jan Wieck) #

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message D'Arcy J.M. Cain 1999-11-03 03:04:06 Re: [HACKERS] Get OID of just inserted record
Previous Message Tyson Oswald 1999-11-02 23:17:42 selecting a certain number of rows