postgresql reset auto increment
snippet in sql

postgresql reset auto increment

user7208

-- if you dont mind losing the data, do the following
TRUNCATE TABLE someTable RESTART IDENTITY;

postgresql reset auto_increment index

user3515

-- Change the starting value of the sequence

ALTER SEQUENCE project_id_seq RESTART 3000;

-- Same but dynamic :

SELECT SETVAL('project_id_seq', (SELECT MAX(id) + 1 FROM project));

postgresql update auto_increment value

user4794

ALTER SEQUENCE product_id_seq RESTART WITH 1453