Reset Postgres primary key sequence

SQL code snippet to reset the primary key sequence in Postgres database table:

SELECT setval('sequence_name', 1);
UPDATE table_name SET primary_key_id = DEFAULT;
Tagged with: ,
Posted in Databases, Postgres

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>

Sites
Categories
Archives