Re: [GENERAL] How to get seq after insert] - Mailing list pgsql-general

From Karl DeBisschop
Subject Re: [GENERAL] How to get seq after insert]
Date
Msg-id 199904151256.IAA27305@skillet.infoplease.com
Whole thread Raw
In response to Re: [GENERAL] How to get seq after insert]  (Bruce Momjian <maillist@candle.pha.pa.us>)
List pgsql-general
On Thu, 15 Apr 1999, Bruce Momjian wrote:

> > On Wed, 14 Apr 1999, Michael Davis wrote:
> >
> > > The safest way is to select the nextval('seq_name') and then insert using
> > > this value.
> >
> > I understand, I just thought something like, I do the insert, and then
> > grab the value with:
> >
> >  $insertid = $sth->{'insertid'};
>
> The OID is returned from the insert.  Use that, or use it to look up the
> field you want.

Actually, I think the number of rows inserted is returned from the
insert, or an error code (a negative number).  But the OID can be
obtained by $oid = sth->{'pg_oid_status'};

--
Karl DeBisschop <kdebisschop@spaceheater.infoplease.com>
617.832.0332 (Fax: 617.956.2696)

Information Please - your source for FREE online reference
http://www.infoplease.com  - Your Ultimate Fact Finder
http://kids.infoplease.com - The Great Homework Helper

pgsql-general by date:

Previous
From: The Hermit Hacker
Date:
Subject: Re: [GENERAL] what is the max postgres db size & table size?
Next
From: darold
Date:
Subject: The WWW of PostgreSQL