Re: Gaps in PK sequence numbers [RESOLVED]

Поиск
Список
Период
Сортировка
От Rich Shepard
Тема Re: Gaps in PK sequence numbers [RESOLVED]
Дата
Msg-id f9ab3b2b-508-ddcf-f01c-3c805242ee3@appl-ecosys.com
обсуждение исходный текст
Ответ на Re: Gaps in PK sequence numbers  (Christophe Pettus <xof@thebuild.com>)
Ответы Re: Gaps in PK sequence numbers [RESOLVED]
Re: Gaps in PK sequence numbers [RESOLVED]
Список pgsql-general
On Mon, 10 Jun 2024, Christophe Pettus wrote:

> Strictly speaking, the sequence underlying nextval() has no idea what
> primary keys are or are not in use. It's just a transaction-ignoring
> counter that increases with each nextval() call. The only reason that
> you'd get duplicate key errors in this case are:
>
> 1. The sequence was reset to a different, lower value.
> 2. Rows were inserted that didn't use the sequence to select a primary key.

Thanks, Christophe. Is there a way to reset the sequence to the maximum
number +1? I don't recall seeing this in the postgres docs but will look
again.

Regards,

Rich



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

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: libpq v17 PQsocketPoll timeout is not granular enough
Следующее
От: Rich Shepard
Дата:
Сообщение: Re: Gaps in PK sequence numbers