Re: [HACKERS] Get OID of just inserted record - Mailing list pgsql-hackers

From wieck@debis.com (Jan Wieck)
Subject Re: [HACKERS] Get OID of just inserted record
Date
Msg-id m11iowW-0003kLC@orion.SAPserv.Hamburg.dsh.de
Whole thread Raw
In response to Re: [HACKERS] Get OID of just inserted record  ("Aaron J. Seigo" <aaron@gtv.ca>)
List 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@debis.com (Jan Wieck) #

pgsql-hackers by date:

Previous
From: Tyson Oswald
Date:
Subject: selecting a certain number of rows
Next
From: "D'Arcy" "J.M." Cain
Date:
Subject: Re: [HACKERS] Get OID of just inserted record