Received: from linux.scd.net ([209.150.198.180]) by postgresql.org (8.11.3/8.11.1) with ESMTP id f4CN0eA14147 for ; Sat, 12 May 2001 19:00:40 -0400 (EDT) (envelope-from borg@errorcode.com) Received: from home ([209.150.198.179]) by linux.scd.net (8.9.3/8.9.3) with ESMTP id PAA14421 for ; Sat, 12 May 2001 15:53:20 -0600 From: "Peter J. Schoenster" Organization: Schoenster To: pgsql-novice@postgresql.org Date: Tue, 15 May 2001 17:47:10 -0600 Subject: Re: [SQL] Is this possible? Reply-to: borg@errorcode.com Message-ID: <3B016B9E.17125.A6AD29A@localhost> In-reply-to: <20010511112417.A20524@cc.usu.edu> References: <9da1vs$13r2$1@news.tht.net>; from wweng@kencast.com on Tue, May 08, 2001 at 09:16:56PM -0400 X-mailer: Pegasus Mail for Win32 (v3.12c) X-Archive-Number: 200105/73 X-Sequence-Number: 1482 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