Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id 9E799475984 for ; Mon, 6 May 2002 10:10:39 -0400 (EDT) Received: from mail-relay.trade-india.com (unknown [203.196.129.235]) by postgresql.org (Postfix) with SMTP id 34E18475C7D for ; Mon, 6 May 2002 09:26:54 -0400 (EDT) Received: (qmail 1801 invoked from network); 6 May 2002 13:20:25 -0000 Received: from system29.trade-india-local.com (HELO server) (192.168.0.29) by ptil-236-129-del.primus-india.net with SMTP; 6 May 2002 13:20:25 -0000 Content-Type: text/plain; charset="iso-8859-1" From: "Rajesh Kumar Mallah." Organization: Infocom Network Limited. To: "Gaetano Mendola" , Subject: Re: SERIAL Field Date: Mon, 6 May 2002 18:56:10 +0530 X-Mailer: KMail [version 1.4] References: <002901c1f4eb$40cbe240$d5a9fea9@GMENDOLA2> In-Reply-To: <002901c1f4eb$40cbe240$d5a9fea9@GMENDOLA2> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Message-Id: <200205061856.10924.mallah@trade-india.com> X-Archive-Number: 200205/29 X-Sequence-Number: 4204 Hi Gaetano, Postgresql implements serial field using sequences. detailed description of sequences are avaliable at http://www.postgresql.org/idocs/index.php?functions-sequence.html a NICE flash tutorial is also available at: http://techdocs.postgresql.org/college/001_sequences/ the specific answer to your question is the function "currval(sequence_name= )" can be used. you can get the name of sequenced being used for the serial field by=20 describing the table (\d tablename). But the very idea of inserting the value and then retriving the sequence=20 number sounds fishy to me. Why not get the sequence number first and than= =20 insert using that seqnce number (more on the flash tutorial ). regds mallah. On Monday 06 May 2002 04:16 pm, Gaetano Mendola wrote: > Hi all, > > having a table with a serial field what is the corrected method > to retrieve the value after an insert ? > > > > > Ciao > Gaetano --=20 Rajesh Kumar Mallah, Project Manager (Development) Infocom Network Limited, New Delhi phone: +91(11)6152172 (221) (L) ,9811255597 (M) Visit http://www.trade-india.com , India's Leading B2B eMarketplace.