- select * FROM table_sequence; # Shows the last_value for the sequence
- select max(colname) FROM table1; # colname is the column in table1 that uses the sequence. Turns out the max was about 20k greater than the last_value from #1
- select setval('sequence_name',"max from #2 +1");
From #1 you will see the sequence_name along with last_value. Use those two in step 3 to get the sequence updated so that when it automatically generates the next value it will be one greater than what is already in the table.