This post helped me for PostgreSQL: postgresql - How to reset sequence in postgres and fill id column with new data? - Stack Overflow
Reset the sequence:
ALTER SEQUENCE sequence_name RESTART;
Then update the table’s ID column:
UPDATE table_name SET id = DEFAULT;