pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Peter J. Schoenster <borg@errorcode.com>
To: pgsql-novice@postgresql.org
Subject: Re: [SQL] Is this possible?
Date: Tue, 15 May 2001 17:47:10 -0600
Message-ID: <3B016B9E.17125.A6AD29A@localhost> (raw)
In-Reply-To: <20010511112417.A20524@cc.usu.edu>
References: <9da1vs$13r2$1@news.tht.net>

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



view thread (3+ messages)

Message-ID: <3B016B9E.17125.A6AD29A@localhost>
Permalink:  ../3B016B9E.17125.A6AD29A@localhost/
Also on:    postgresql.org/message-id/3B016B9E.17125.A6AD29A@localhost

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: borg@errorcode.com, pgsql-novice@postgresql.org
  Subject: Re: [SQL] Is this possible?
  In-Reply-To: <3B016B9E.17125.A6AD29A@localhost>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox