It’s very easy to truncate table in any database but all database have some uniqueness in each of them. I have written this quick tip to show how we can truncate table in PostgreSQL with restarting primary key auto increment value.
Here is the simple command to truncate table but it won’t reset the autoincrement value of a primary key.
Here is the trick to truncate a table and restart primary key value.
TRUNCATE "table_name" RESTART IDENTITY;