Re: FW: reset all sequences - Mailing list pgsql-admin

From Stephan Szabo
Subject Re: FW: reset all sequences
Date
Msg-id 20060508234048.E49285@megazone.bigpanda.com
Whole thread Raw
In response to FW: reset all sequences  ("Pascal Tufenkji" <ptufenkji@usj.edu.lb>)
List pgsql-admin
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).

pgsql-admin by date:

Previous
From: "Pascal Tufenkji"
Date:
Subject: FW: reset all sequences
Next
From: Thusitha Kodikara
Date:
Subject: Re: FW: reset all sequences