pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Bruno Wolff III <bruno@wolff.to>
To: missive@hotmail.com
Cc: pgsql-admin@postgresql.org
Subject: Re: Reset sequence number
Date: Mon, 25 Feb 2002 09:28:48 -0600
Message-ID: <20020225152848.GA31650@wolff.to> (raw)
In-Reply-To: <slrna7fiul.5v.missive@whave.frontiernet.net>
References: <3C777F09.854C8FD4@nospan_hotmail.com>
	<slrna7fiul.5v.missive@whave.frontiernet.net>

On Sat, Feb 23, 2002 at 05:07:34PM +0000,
  Lee Harr <missive@frontiernet.net> 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).



view thread (4+ messages)  latest in thread

Message-ID: <20020225152848.GA31650@wolff.to>
Permalink:  ../20020225152848.GA31650@wolff.to/
Also on:    postgresql.org/message-id/20020225152848.GA31650@wolff.to

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-admin@postgresql.org
  Cc: bruno@wolff.to, missive@hotmail.com
  Subject: Re: Reset sequence number
  In-Reply-To: <20020225152848.GA31650@wolff.to>
  References: <3C777F09.854C8FD4@nospan_hotmail.com> <slrna7fiul.5v.missive@whave.frontiernet.net> <20020225152848.GA31650@wolff.to>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox