I know this question is kind of silly, I need to run these queries to see if the values are out of sync, but I get an error like 'relation does not exist':
SELECT MAX(the_primary_key) FROM the_table;
SELECT nextval('the_primary_key_sequence');
I have a table named "Audit" with the primary key column 'auditID'. When I run the first query I got the result:
SELECT MAX('auditID') FROM "Audit";
max
---------
auditID
(1 row)
but the max should be more than 10000.
Then I run the second query and I get the error 'relation "the_primary_key_sequence" or "Audit_auditID_seq" does not exist'. How can I check if any primary key sequence exists or not?
Error:
select setval('Audit_auditID_seq', 171832, true);
ERROR: relation "audit_auditid_seq" does not exist
LINE 1: select setval('Audit_auditID_seq', 171832, true);