Received: from localhost.localdomain (postgresql.org [64.49.215.8]) by localhost (Postfix) with ESMTP id BF0AC47650B for ; Thu, 6 Jun 2002 08:08:28 -0400 (EDT) Received: from kitana.asti.dost.gov.ph (kitana.asti.dost.gov.ph [202.90.128.8]) by postgresql.org (Postfix) with ESMTP id 63C89476546 for ; Thu, 6 Jun 2002 08:03:27 -0400 (EDT) Received: from asti.dost.gov.ph (askr.asti.dost.gov.ph [10.10.5.36]) by kitana.asti.dost.gov.ph (Postfix) with ESMTP id BD5B125811; Thu, 6 Jun 2002 20:00:58 +0800 (PHT) Message-ID: <3D000390.D5272E3A@asti.dost.gov.ph> Date: Thu, 06 Jun 2002 20:51:28 -0400 From: Joseph Syjuco Organization: Advanced Science and Technology Institute X-Mailer: Mozilla 4.78 [en] (X11; U; Linux 2.4.8-26mdk i586) X-Accept-Language: en MIME-Version: 1.0 To: Bruno Wolff III Cc: pgsql-sql@postgresql.org Subject: Re: how to reset serials References: <3CFFF865.A0A77DD@asti.dost.gov.ph> <20020606114824.GA8206@wolff.to> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit X-Archive-Number: 200206/51 X-Sequence-Number: 8016 thanks for the tip ... im close to dropping and recreating my table Bruno Wolff III wrote: > > On Thu, Jun 06, 2002 at 20:03:49 -0400, > Joseph Syjuco wrote: > > how can i reset my serial field to 0. Tried using setval but it only > > allows setting of my next serial to 2 > > joseph > > >From the 7.2.1 documentation: > SELECT setval('foo', 42); Next nextval() will return 43 > SELECT setval('foo', 42, true); Same as above > SELECT setval('foo', 42, false); Next nextval() will return 42 > > So you want to use (assuming you really want the next value to be 1): > SELECT setval('your_sequence', 1, false);