Received: from ntmrtr01.mpic.mb.ca (smtp.mpi.mb.ca [205.200.128.99]) by hub.org (8.10.1/8.10.1) with ESMTP id e5SHXD132821 for ; Wed, 28 Jun 2000 13:33:18 -0400 (EDT) Received: by NTMRTR01 with Internet Mail Service (5.5.2650.21) id ; Wed, 28 Jun 2000 12:35:28 -0500 Message-ID: From: "Lea, Michael" To: "'pgsql-sql@postgresql.org'" Subject: retrieving a serial number Date: Wed, 28 Jun 2000 12:35:49 -0500 MIME-Version: 1.0 X-Mailer: Internet Mail Service (5.5.2650.21) Content-Type: text/plain X-Archive-Number: 200006/261 I have one table (call it "master") that, among other things, contains a serial number. I have a number of other tables (call them "slaves") that, among other things, contain a foreign key referring to the serial number in the first table. I will be inserting one row into the master table, and one row into zero or more slave tables in each transaction. What I want to do is use a sequence in the master table to let PostgreSQL automatically generate a unique serial number for me, but I need to know the serial number in order to insert the corresponding rows into the slave table(s). Is there any way of retrieving the serial number that will be used before the transaction has been committed? Or will I have to generate my own serial numbers? Michael Lea Information Security Manitoba Public Insurance Phone: (204) 985-8224