Re: Reset sequence number

Поиск
Список
Период
Сортировка
От Bruno Wolff III
Тема Re: Reset sequence number
Дата
Msg-id 20020225152848.GA31650@wolff.to
обсуждение исходный текст
Ответ на Re: Reset sequence number  (missive@frontiernet.net (Lee Harr))
Список pgsql-admin
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).

В списке pgsql-admin по дате отправления:

Предыдущее
От: "Zeugswetter Andreas SB SD"
Дата:
Сообщение: Re: Backup and Recovery (revisited)
Следующее
От: Denis Chavez
Дата:
Сообщение: About RBAC in postgres