Re: FW: reset all sequences

Поиск
Список
Период
Сортировка
От Stephan Szabo
Тема Re: FW: reset all sequences
Дата
Msg-id 20060508234048.E49285@megazone.bigpanda.com
обсуждение исходный текст
Ответ на FW: reset all sequences  ("Pascal Tufenkji" <ptufenkji@usj.edu.lb>)
Список 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 по дате отправления:

Предыдущее
От: "Pascal Tufenkji"
Дата:
Сообщение: FW: reset all sequences
Следующее
От: Thusitha Kodikara
Дата:
Сообщение: Re: FW: reset all sequences