finding highest value used in a postgres sequence

Dr. Hawkins dochawk at gmail.com
Tue Nov 15 16:51:52 EST 2016


The postgres server defines the values used in my unqKy variable, a
sequence.

In dealing with backups and a glitch already gone wrong, however, I have
found that postgres seems to remember previously used values, even after
ALTER SEQUENCE/RESET--but still assigns this enumbers.

So After I use the MAX(uniqKy)+1 to reset the sequence, a later INSERT
without specifying is throwing an error as it assigns a currently unused
number.

The nextval/lastval/etc functions don't seem to have "maxval()" that I can
use as a new maximum.

I'd appreciate any ideas . . .

-- 
Dr. Richard E. Hawkins, Esq.
(702) 508-8462



More information about the use-livecode mailing list