Re: [SQL] Is this possible? - Mailing list pgsql-novice

From Peter J. Schoenster
Subject Re: [SQL] Is this possible?
Date
Msg-id 3B016B9E.17125.A6AD29A@localhost
Whole thread Raw
List pgsql-novice
On 11 May 2001, at 11:24, Roberto Mello wrote:

> On Tue, May 08, 2001 at 09:16:56PM -0400, Wei Weng wrote:
> > I have a table that has a serial for primary key. Is it possible to
> > get the new available primary key right after I insert a row of new
> > entry?
>
>  Yeah. Se the documentation on triggers.

My method is to insert into the target table(s) in advance.

my ($job_id) = $self->{dbh}->selectrow_array(qq|SELECT
NEXTVAL ('zipinfo_job_id_seq')|);

and then I use job_id as a hidden value in the form that gets printed.

Peter



---------------------------
"Reality is that which, when you stop believing in it, doesn't go
away".
                -- Philip K. Dick

pgsql-novice by date:

Previous
From: pete@example.compulink.co.uk
Date:
Subject: Re: Looking for good reference materials for SQL programming.
Next
From: Tom Lane
Date:
Subject: Re: psql