Received: from wolff.to (wolff.to [66.92.219.49]) by postgresql.org (Postfix) with SMTP id A6D35476416 for ; Mon, 25 Feb 2002 10:26:51 -0500 (EST) Received: (qmail 31683 invoked by uid 500); 25 Feb 2002 15:28:48 -0000 Date: Mon, 25 Feb 2002 09:28:48 -0600 From: Bruno Wolff III To: missive@hotmail.com Cc: pgsql-admin@postgresql.org Subject: Re: Reset sequence number Message-ID: <20020225152848.GA31650@wolff.to> Mail-Followup-To: missive@hotmail.com, pgsql-admin@postgresql.org References: <3C777F09.854C8FD4@nospan_hotmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.3.25i X-Archive-Number: 200202/340 X-Sequence-Number: 3493 On Sat, Feb 23, 2002 at 05:07:34PM +0000, Lee Harr wrote: > > How can I reset a sequence number back to 0 ? > > > > SELECT setval('sequence_name', 0); > > > In order for this to work, the sequence must have been created with > a MINVALUE of 0 (the default MINVALUE is 1) > > CREATE SEQUENCE sequence_name MINVALUE 0; Note, that if you do it this way, 1 will be the next sequent number returned by nextval. If you want 0 to be returned next use setval('seq_name', 0, false).