postgres "serial primary key" recycling values

Bob Sneidar bobsneidar at iotecdigital.com
Thu Sep 1 13:32:09 EDT 2016


Right. I don't think any SQL database does. They all store the next unique key value(s) in some kind of master table for the database. That is what nextval() returns, not the next unused sequence.

Bob S


On Aug 31, 2016, at 14:31 , Dr. Hawkins <dochawk at gmail.com<mailto:dochawk at gmail.com>> wrote:

I think I see what is happening.

The nextval() in postgres does *not* consider the numbers in use in the
sequence; I thought it had.

So adding

put "ALTER SEQUENCE " & dhtbl_dbtr & "_unqKy_seq RESTART WITH 1001;" & cr
after dcmd


Instead of inserting ckCap solves the problem.

I tried

MIN(1001, MAX(unqKy))

but it didn't like the min




More information about the use-livecode mailing list