Find sequences:

\c database_name
\ds

For each, run:

SELECT setval('your_table_id_seq', (SELECT MAX(id) FROM your_table));