Re: changing the last_value in a sequence

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: changing the last_value in a sequence
Дата
Msg-id 25486.1045597874@sss.pgh.pa.us
обсуждение исходный текст
Ответ на changing the last_value in a sequence  ("Aurangzeb M. Agha" <aagha@bigfoot.com>)
Список pgsql-general
"Aurangzeb M. Agha" <aagha@bigfoot.com> writes:
> I quickly figured out that I can't update the last_value in my sequence
> table.

You can use setval().  However, if you're using a sequence to generate
IDs then it's fundamentally broken to assume there will be no gaps in
the assigned IDs.  (You'll get a gap anytime an inserting transaction
fails after having done nextval().)  I suggest rethinking your assumption
that there must be a consecutive sequence of TODO numbers ...

            regards, tom lane

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

Предыдущее
От: Jean-Luc Lachance
Дата:
Сообщение: Re: Table Partitioning in Postgres:
Следующее
От: Jan Wieck
Дата:
Сообщение: Re: Anybody see the post?