Re: [GENERAL] How to get seq after insert]

From: Bruce Momjian <maillist(at)candle(dot)pha(dot)pa(dot)us>
To: signal(at)shreve(dot)net (Brian)
Cc: michael(dot)davis(at)tvguide(dot)com, pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] How to get seq after insert]
Date: 1999-04-15 04:07:43
Message-ID: 199904150407.AAA27406@candle.pha.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)candle(dot)pha(dot)pa(dot)us | (610) 853-3000
+ If your life is a hard drive, | 830 Blythe Avenue
+ Christ can be your backup. | Drexel Hill, Pennsylvania 19026

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Guo Ge 1999-04-15 07:25:19 (no subject)
Previous Message Brian 1999-04-14 21:54:41 RE: [GENERAL] How to get seq after insert