Gaps in PK sequence numbers

Поиск
Список
Период
Сортировка
От Rich Shepard
Тема Gaps in PK sequence numbers
Дата
Msg-id 35fd10ab-5f7f-7a57-9cc5-c03d81476d13@appl-ecosys.com
обсуждение исходный текст
Ответы Re: Gaps in PK sequence numbers
Re: Gaps in PK sequence numbers
Список pgsql-general
Over the years I've deleted rows from tables leaving gaps in the PK sequence
numbers. I've now learned that using nextval('sequencename') finds those
gaps and tells me that the value after the gap is already assigned.

I found a web page that explains how to find the gaps in a sequence, yet I
want to understand why nextval() doesn't begin with the max(FK)+1 value.

When I tried inserting new rows in the companies table psql told me that PK
value 2310 already existed. Selecting max(PK) returned 2341. When entering
multiple new rows is there a way to ignore gaps?

TIA,

Rich



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

Предыдущее
От: Rich Shepard
Дата:
Сообщение: Re: Multiple tables row insertions from single psql input file [RESOLVED]
Следующее
От: Thomas Munro
Дата:
Сообщение: Re: libpq v17 PQsocketPoll timeout is not granular enough