pg.ddx.io  pgsql-admin@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Stephan Szabo <sszabo@megazone.bigpanda.com>
To: Pascal Tufenkji <ptufenkji@usj.edu.lb>
Cc: pgsql-admin@postgresql.org
Subject: Re: FW: reset all sequences
Date: Mon, 8 May 2006 23:42:38 -0700 (PDT)
Message-ID: <20060508234048.E49285@megazone.bigpanda.com> (raw)
In-Reply-To: <200605090642.k496gTV8021264@Citrus.usj.edu.lb>
References: <200605090642.k496gTV8021264@Citrus.usj.edu.lb>

On Tue, 9 May 2006, Pascal Tufenkji wrote:

> How can I reset the sequence to "1"
>
> If I use the following statement
>
> Select setval('mytable_id_seq',1);
>
> I put the last value as 1
>
> So when I insert a new row the value will be "2" and not "1" as it should be
>
> I cannot put Select setval('mytable_id_seq',0);
>
> What should I do ??!!

You should be able to do this with the three argument form of setval as
setval('mytable_id_seq',1,false).



view thread (7+ messages)  latest in thread

Message-ID: <20060508234048.E49285@megazone.bigpanda.com>
Permalink:  ../20060508234048.E49285@megazone.bigpanda.com/
Also on:    postgresql.org/message-id/20060508234048.E49285@megazone.bigpanda.com

 · 

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: sszabo@megazone.bigpanda.com, ptufenkji@usj.edu.lb
  Subject: Re: FW: reset all sequences
  In-Reply-To: <20060508234048.E49285@megazone.bigpanda.com>
  References: <200605090642.k496gTV8021264@Citrus.usj.edu.lb> <20060508234048.E49285@megazone.bigpanda.com>

* 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