MSNCodeSNIPPETS← msncode.dev
snippets/postgres

Reset Auto-Increment (Serial)

Reset the auto-increment counter to a specific value

postgressqlserialreset
SQL
ALTER SEQUENCE table_name_id_seq RESTART WITH 1;

More postgres snippets

Create User and Database

Create a new PostgreSQL user and database

Describe Table Structure

Show columns, types, and constraints of a table

Export Table to CSV

Export a PostgreSQL table to a CSV file

Find Duplicate Rows

Find rows with duplicate values in a column