From: | Bruce Cota <bruce(at)vivi(dot)com> |
---|---|
To: | Martijn van Oosterhout <kleptog(at)svana(dot)org>, pgsql-general(at)postgresql(dot)org |
Subject: | Re: Getting OID after Insert |
Date: | 2001-10-18 14:29:09 |
Message-ID: | 3BCEE735.5E22A024@vivi.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-general |
Thank you!
Hopefully that getlastoid refers to the last oid
created in this session or transaction? I can't find it
mentioned in the docs anywhwere.
Nextval and curval aren't specific to the transaction or
session, right? so that would be problematic in a
multi-user environment.
Martijn van Oosterhout wrote:
> 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.
From | Date | Subject | |
---|---|---|---|
Next Message | Bruce Momjian | 2001-10-18 14:55:33 | Re: To Postgres Devs : Wouldn't changing the select limit |
Previous Message | Mihai Gheorghiu | 2001-10-18 14:25:53 | Please help |