From: Bruce Momjian <pgman@candle.pha.pa.us>
To: John C Cusick <jcc2@juno.com>
Cc: pgsql-sql@postgreSQL.org
Subject: Re: [SQL] Getting last used oid
Date: Tue, 7 Dec 1999 19:19:23 -0500 (EST)
Message-ID: <199912080019.TAA15142@candle.pha.pa.us> (raw)
In-Reply-To: <19991207.113118.-748361.0.jcc2@juno.com>
> 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@candle.pha.pa.us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: pgman@candle.pha.pa.us, jcc2@juno.com
Subject: Re: [SQL] Getting last used oid
In-Reply-To: <199912080019.TAA15142@candle.pha.pa.us>
References: <19991207.113118.-748361.0.jcc2@juno.com> <199912080019.TAA15142@candle.pha.pa.us>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox