Answers for "reset auto-increment postgresql"

SQL
1

postgresql reset auto increment

-- if you dont mind losing the data, do the following
TRUNCATE TABLE someTable RESTART IDENTITY;
Posted by: Guest on January-15-2021
0

postgresql reset auto_increment index

-- 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));
Posted by: Guest on September-10-2020

Code answers related to "reset auto-increment postgresql"

Code answers related to "SQL"

Browse Popular Code Answers by Language