Re: serial column vs. explicit sequence question

From: Josh Berkus <josh(at)agliodbs(dot)com>
To: Charlie Toohey <ctoohey(at)pacbell(dot)net>, pgsql-sql(at)postgresql(dot)org
Subject: Re: serial column vs. explicit sequence question
Date: 2002-06-13 21:04:28
Message-ID: 200206131404.28257.josh@agliodbs.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Stephan Szabo 2002-06-13 21:06:06 Re: serial column vs. explicit sequence question
Previous Message Tom Lane 2002-06-13 20:07:26 Re: Another postgres 'file not found' error