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

From Bruce Momjian
Subject Re: [GENERAL] How to get seq after insert]
Date
Msg-id 199904150407.AAA27406@candle.pha.pa.us
Whole thread Raw
In response to RE: [GENERAL] How to get seq after insert  (Brian <signal@shreve.net>)
Responses Re: [GENERAL] How to get seq after insert]  (Karl DeBisschop <kdebisschop@spaceheater.infoplease.com>)
List pgsql-general
> 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.

--
  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

pgsql-general by date:

Previous
From: Brian
Date:
Subject: RE: [GENERAL] How to get seq after insert
Next
From: Guo Ge
Date:
Subject: (no subject)