Check out example codes for "postgresql reset auto_increment index". It will help you in understanding the concepts better.

Code Example 1

ALTER SEQUENCE product_id_seq RESTART WITH 1453

Code Example 2

-- 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));

Learn ReactJs, React Native from akashmittal.com