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;
Avinash Zala is leading various projects which deals with the various technology involved with the web. A combination of perfect technical and management skills. Avinash would like to chat with you and convert your imagination into the working system. You can get in touch with him on Facebook and Twitter.
View all posts by: Avinash