Received: from sss.sss.pgh.pa.us (sss.pgh.pa.us [209.114.166.2]) by hub.org (8.9.3/8.9.3) with ESMTP id MAA71792 for ; Tue, 7 Dec 1999 12:46:08 -0500 (EST) (envelope-from tgl@sss.pgh.pa.us) Received: from sss.sss.pgh.pa.us (localhost [127.0.0.1]) by sss.sss.pgh.pa.us (8.9.1/8.9.1) with ESMTP id MAA23885; Tue, 7 Dec 1999 12:45:35 -0500 (EST) To: "'Gary Stainburn'" cc: "'Pgsql Interfaces'" Subject: Re: [INTERFACES] locking on database updates In-reply-to: Your message of Tue, 7 Dec 1999 18:26:41 +0100 <01BF40E0.9C3B30C0@agen.int.ghs> Date: Tue, 07 Dec 1999 12:45:35 -0500 Message-ID: <23883.944588735@sss.pgh.pa.us> From: Tom Lane > The problem is that this does not actually give me the number that > was just created. As there is no guarantee that the other fields in > the table are unique (hence the serial field in the first place) I cannot > simply do a select to retrieve it. Easiest answer is to do SELECT nextval('sequence_object'); and then INSERT the new row into your table using the value you just obtained as an explicit value for the ID column, thus overriding the default expression. regards, tom lane