pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Joseph Syjuco <joseph@asti.dost.gov.ph>
To: Bruno Wolff III <bruno@wolff.to>
Cc: pgsql-sql@postgresql.org
Subject: Re: how to reset serials
Date: Thu, 06 Jun 2002 20:51:28 -0400
Message-ID: <3D000390.D5272E3A@asti.dost.gov.ph> (raw)
References: <3CFFF865.A0A77DD@asti.dost.gov.ph>
	<20020606114824.GA8206@wolff.to>

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 <joseph@asti.dost.gov.ph> 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);



view thread (3+ messages)

Message-ID: <3D000390.D5272E3A@asti.dost.gov.ph>
Permalink:  ../3D000390.D5272E3A@asti.dost.gov.ph/
Also on:    postgresql.org/message-id/3D000390.D5272E3A@asti.dost.gov.ph

 · 

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 using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: joseph@asti.dost.gov.ph, bruno@wolff.to
  Subject: Re: how to reset serials
  In-Reply-To: <3D000390.D5272E3A@asti.dost.gov.ph>

* 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