Re: [SQL] Getting last used oid

From: Bruce Momjian <pgman(at)candle(dot)pha(dot)pa(dot)us>
To: John C Cusick <jcc2(at)juno(dot)com>
Cc: pgsql-sql(at)postgreSQL(dot)org
Subject: Re: [SQL] Getting last used oid
Date: 1999-12-08 00:19:23
Message-ID: 199912080019.TAA15142@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

> To All,
>
> How can I call up the last oid used in an insert statement? I've checked
> the docs (but not the source - getting a little big :-) by way of the
> TOC's and didn't see it. I'm assuming/hoping there is a function
> similar to lastval, curval, nextval for sequences available to
> do this that I would like to use in a trigger to populate another table.
>
> I also did a perusal of the new book, which looks *_really_* good so far,
> but it didn't have what I was hoping to find.
>
> I can do it normally of course (select oid, 'last_inserted_unique_field')
> from table;) but
> i would like a more behind the scenes way.
6.6 or 7.0 will have a :LastOid variable in psql. From libpq in C,
there are functions to access it.

--
Bruce Momjian | http://www.op.net/~candle
maillist(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Chris Griffin 1999-12-08 01:03:52 select distinct?
Previous Message Stuart Rison 1999-12-07 17:57:30 Re: [SQL] Fw: Whats happen here?