postgresql truncate table cascade restart identity code example
Example 1: restart identity cascade
TRUNCATE <table_name> RESTART IDENTITY CASCADE;
--RESTART will reset the identity sequence
--CASCADE all tables that have a foreign key reference to
--table_name will be truncated as well
Example 2: postgresql truncate cascade restart identity
TRUNCATE bigtable, fattable RESTART IDENTITY;