In my dataBase i have 120 tables , and each table get his own sequence like this :
CREATE TABLE myTable
(
id bigint NOT NULL DEFAULT nextval('mySequence'::regclass),
...
Sometimes i am forced to add some data from postgres and it create a problem with the sequence : each time i add an information the sequence isn't updated
my question is : is there any sql request i can use to list the table with the sequence and compare the last_value FROM my sequence
with the MAX(id) FROM myTable
Additionnal question : is there any risque to compare the last_value
with MAX(id)