Re: Getting OID after Insert

From: Martijn van Oosterhout <kleptog(at)svana(dot)org>
To: Bruce Cota <bruce(at)vivi(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Getting OID after Insert
Date: 2001-10-18 15:05:45
Message-ID: 20011019010545.J7364@svana.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Wed, Oct 17, 2001 at 11:18:44PM -0400, Bruce Cota wrote:
> Is there a way, in SQL, to access the oid of the row created
> by an immediately preceding insert statement?
>
> e.g.
>
> insert into t (x, y) values (1, 2);
>
> select * from t where oid = <what goes here?>
>
> Thanks for any advice.

Yeah, the is a getlastoid function.

sequences, nextval, currval and lastval are a better bet though.

--
Martijn van Oosterhout <kleptog(at)svana(dot)org>
http://svana.org/kleptog/
> Magnetism, electricity and motion are like a three-for-two special offer:
> if you have two of them, the third one comes free.

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message t.ngockhoi 2001-10-18 15:09:20 Can not input large text data
Previous Message Nick 2001-10-18 14:57:21 please ignore