pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Josh Berkus <josh@agliodbs.com>
To: Charlie Toohey <ctoohey@pacbell.net>
To: pgsql-sql@postgresql.org
Subject: Re: serial column vs. explicit sequence question
Date: Thu, 13 Jun 2002 14:04:28 -0700
Message-ID: <200206131404.28257.josh@agliodbs.com> (raw)
In-Reply-To: <20020613200344.1B97A476B74@postgresql.org>
References: <20020613200344.1B97A476B74@postgresql.org>


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




view thread (8+ messages)  latest in thread

Message-ID: <200206131404.28257.josh@agliodbs.com>
Permalink:  ../200206131404.28257.josh@agliodbs.com/
Also on:    postgresql.org/message-id/200206131404.28257.josh@agliodbs.com

 · 

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: josh@agliodbs.com, ctoohey@pacbell.net
  Subject: Re: serial column vs. explicit sequence question
  In-Reply-To: <200206131404.28257.josh@agliodbs.com>

* 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