pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Is this possible?
3+ messages / 3 participants
[nested] [flat]

* Is this possible?
@ 2001-05-09 01:16  Wei Weng <wweng@kencast.com>
  0 siblings, 2 replies; 3+ messages in thread

From: Wei Weng @ 2001-05-09 01:16 UTC (permalink / raw)
  To: pgsql-sql

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?

Thanks

Wei



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Is this possible?
@ 2001-05-11 17:24  Roberto Mello <rmello@cc.usu.edu>
  parent: Wei Weng <wweng@kencast.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Roberto Mello @ 2001-05-11 17:24 UTC (permalink / raw)
  To: Wei Weng <wweng@kencast.com>; +Cc: pgsql-sql

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.

	-Roberto
-- 
+----| http://fslc.usu.edu USU Free Software & GNU/Linux Club |------+
  Roberto Mello - Computer Science, USU - http://www.brasileiro.net 
       http://www.sdl.usu.edu - Space Dynamics Lab, Developer    
"Data! I thought you were dead!" "No, Sir. I rebooted."



^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: [SQL] Is this possible?
@ 2001-05-15 23:47  Peter J. Schoenster <borg@errorcode.com>
  parent: Wei Weng <wweng@kencast.com>
  1 sibling, 0 replies; 3+ messages in thread

From: Peter J. Schoenster @ 2001-05-15 23:47 UTC (permalink / raw)
  To: pgsql-novice@postgresql.org

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



^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2001-05-15 23:47 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2001-05-09 01:16 Is this possible? Wei Weng <wweng@kencast.com>
2001-05-11 17:24 ` Roberto Mello <rmello@cc.usu.edu>
2001-05-15 23:47 ` Peter J. Schoenster <borg@errorcode.com>

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