Search Postgresql Archives

Gaps in PK sequence numbers

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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





[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Postgresql Jobs]     [Postgresql Admin]     [Postgresql Performance]     [Linux Clusters]     [PHP Home]     [PHP on Windows]     [Kernel Newbies]     [PHP Classes]     [PHP Databases]     [Postgresql & PHP]     [Yosemite]

  Powered by Linux