Received: from localhost (maia-2.hub.org [200.46.204.187]) by postgresql.org (Postfix) with ESMTP id B77579FB1E5 for ; Thu, 1 Feb 2007 14:32:32 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.187]) (amavisd-new, port 10024) with ESMTP id 63375-07 for ; Thu, 1 Feb 2007 14:32:25 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.4 Received: from sss.pgh.pa.us (sss.pgh.pa.us [66.207.139.130]) by postgresql.org (Postfix) with ESMTP id 28F8A9FB20F for ; Thu, 1 Feb 2007 14:32:26 -0400 (AST) Received: from sss2.sss.pgh.pa.us (tgl@localhost [127.0.0.1]) by sss.pgh.pa.us (8.13.6/8.13.6) with ESMTP id l11IWJpe020384; Thu, 1 Feb 2007 13:32:19 -0500 (EST) To: =?iso-8859-1?Q?Andr=E9_Jos=E9_Guergolet?= cc: pgsql-sql@postgresql.org Subject: Re: Insert Data and autonumeric field In-reply-to: References: Comments: In-reply-to =?iso-8859-1?Q?Andr=E9_Jos=E9_Guergolet?= message dated "Thu, 01 Feb 2007 16:09:22 -0300" Date: Thu, 01 Feb 2007 13:32:19 -0500 Message-ID: <20383.1170354739@sss.pgh.pa.us> From: Tom Lane X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200702/4 X-Sequence-Number: 27338 =?iso-8859-1?Q?Andr=E9_Jos=E9_Guergolet?= writes: > INSERT INTO table1 (date, field2, field3) VALUES (now,'value2','value3'); > SELECT last_value FROM seq_table1; You should never ever look directly at the sequence table (except perhaps for manual debugging purposes). I think you may have confused this with use of the lastval() function --- currval() or sometimes lastval() are the appropriate way to get the last-assigned value. regards, tom lane