Re: serial column vs. explicit sequence question - Mailing list pgsql-sql

From Josh Berkus
Subject Re: serial column vs. explicit sequence question
Date
Msg-id 200206131404.28257.josh@agliodbs.com
Whole thread Raw
In response to serial column vs. explicit sequence question  (Charlie Toohey <ctoohey@pacbell.net>)
List pgsql-sql
Charlie,

> Lets say I need to insert a row into the master table and N rows into the
> detail table. After inserting a row into master, and before detail, I need
to
> read the master table to obtain the value of the id for the row just
> inserted, so I can insert this id as the foreign key value for the N rows in
> the detail table.

Hey, what about CURRVAL('sequence_name')?

--
-Josh Berkus



pgsql-sql by date:

Previous
From: Vernon Wu
Date:
Subject: Please help me out on this insert error
Next
From: Stephan Szabo
Date:
Subject: Re: serial column vs. explicit sequence question