postgresql update sequence to max value code example
Example 1: postgres set sequence value to max id
SELECT setval('table_id_seq', (SELECT MAX(id) FROM table));
Example 2: update postgres sequence to max
SELECT setval('table_id_seq', (SELECT MAX(id) FROM table)+1);