RE: [GENERAL] How to get seq after insert

From: Brian <signal(at)shreve(dot)net>
To: Michael Davis <michael(dot)davis(at)tvguide(dot)com>
Cc: pgsql-general(at)postgreSQL(dot)org
Subject: RE: [GENERAL] How to get seq after insert
Date: 1999-04-14 21:54:41
Message-ID: Pine.LNX.4.10.9904141651080.19854-100000@mercury.shreve.net
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'};

assuming field "insertid" was the one being updated by the sequence, but
that doenst seem to work.

>
> -----Original Message-----
> From: Brian [SMTP:signal(at)shreve(dot)net]
> Sent: Wednesday, April 14, 1999 2:59 PM
> To: pgsql-general(at)postgreSQL(dot)org
> Subject: [GENERAL] How to get seq after insert
>
>
> I have a sequence in a table that increments upon insert. After
> doing the
> insert, is their a way (function maybe?) to get the sequences value
> without having to do another select?
>
> Brian
>
>
> -----------------------------------------------------
> Brian Feeny (BF304) signal(at)shreve(dot)net
> 318-222-2638 x 109 http://www.shreve.net/~signal
> Network Administrator ShreveNet Inc. (ASN 11881)
>
>

-----------------------------------------------------
Brian Feeny (BF304) signal(at)shreve(dot)net
318-222-2638 x 109 http://www.shreve.net/~signal
Network Administrator ShreveNet Inc. (ASN 11881)

In response to

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Bruce Momjian 1999-04-15 04:07:43 Re: [GENERAL] How to get seq after insert]
Previous Message Michael Davis 1999-04-14 21:39:44 RE: [GENERAL] How to get seq after insert