How to reset sequence in postgres and fill id column with new data ?
PostgreSQL 8.4 or newer there is no have to particular the WITH 1 anymore. The start value that was recorded by CREATE SEQUENCE or last set by ALTER SEQUENCE START WITH will be used (most probably this will be 1).
ALTER SEQUENCE seq RESTART;
Then update table:
UPDATE foo SET id = DEFAULT;
Refer this source :