Skip to content

Instantly share code, notes, and snippets.

View sivabudh's full-sized avatar

Sivabudh Umpudh sivabudh

View GitHub Profile
@scaryguy
scaryguy / change_id_column
Last active March 21, 2022 15:24
How to reset ID column of a PostgreSQL table to let auto incrementation begin from 1?
# See your sequence name inside psql console with \ds command.
ALTER SEQUENCE seq RESTART WITH 1;
# Update sequence
UPDATE table_name SET id=nextval('seq');