Re: [GENERAL] returning oid of last insert?

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: matthew(dot)mcclure(at)yale(dot)edu (Matt McClure)
Cc: peter(at)retep(dot)org(dot)uk, pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] returning oid of last insert?
Date: 1998-07-21 19:02:45
Message-ID: 199807211902.PAA02163@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

> Thanks for the help. I checked libpq, and just to follow up, it is quite
> easy to get the oid of the last insert using the routine oidStatus.
>
> On Sun, 19 Jul 1998, Peter T Mount wrote:
>
> > On Sat, 18 Jul 1998, Matt McClure wrote:
> >
> > > Is there a way to return the oid of the last insert command?
> >
> > The protocol does return the oid, as a string. You can see this when using
> > psql. I'm not sure what libpq function returns this value though.
> >
> > In JDBC, there isn't an official way, but the 6.4 driver does have a
> > method to retrieve the oid (It's used internally with the new object
> > serialization code). Earler versions store the string, but don't use it,
> > and have no method to retrieve it.

I have added this to the TODO list:

* add a function to return the last inserted oid, for use in psql scripts

We need it for psql scripts. Things using libpq directly already have
access to this information.

--
Bruce Momjian | 830 Blythe Avenue
maillist(at)candle(dot)pha(dot)pa(dot)us | Drexel Hill, Pennsylvania 19026
+ If your life is a hard drive, | (610) 353-9879(w)
+ Christ can be your backup. | (610) 853-3000(h)

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Konstantinos Vassiliadis 1998-07-21 19:29:58 Re: [GENERAL] Postgres superuser priviledges
Previous Message Konstantinos Vassiliadis 1998-07-21 18:56:26 Re: [NOVICE] Re: [GENERAL] Postgres superuser priviledges