Received: from gw.acate.com.br ([200.215.17.89]) by mail.postgresql.org (8.11.1/8.11.1) with ESMTP id eA7GsTs64115 for ; Tue, 7 Nov 2000 11:54:30 -0500 (EST) (envelope-from edmar@brasmap.com) Received: from joana ([192.168.1.13]) by gw.acate.com.br (8.9.3/8.9.3) with SMTP id OAA19228; Tue, 7 Nov 2000 14:52:10 -0200 From: "Edmar Wiggers" To: "Indraneel Majumdar" , Subject: RE: reinitialise serial counter Date: Tue, 7 Nov 2000 14:55:20 -0200 Message-ID: MIME-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: 7bit X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook IMO, Build 9.0.2416 (9.0.2910.0) X-MimeOLE: Produced By Microsoft MimeOLE V5.00.2615.200 Importance: Normal In-Reply-To: X-Archive-Number: 200011/49 X-Sequence-Number: 80 > after inserting values and doing delete from test if I try to insert > values again, the id starts from where it left off previously. How can I > get the serial counter to restart from 1 ? is it anything to do with > setval(). How to use the setval? The serial value is implemented using a sequence object (see the docs). Once a sequence returns a number it will never return it again (that's what sequences are for!). A serial field is not a good approach if you always want to start numbering at 1. Yours sincerely, Edmar Wiggers BRASMAP Information Systems +55 48 9960 2752