Sequence does not reset after truncating the table

Use the TRUNCATE SQL command.

For a single table the syntax is the following:

TRUNCATE TABLE table_name RESTART IDENTITY;

For multiple tables:

TRUNCATE TABLE table_foo, table_bar RESTART IDENTITY;

What it does:

Automatically restart sequences owned by columns of the truncated table(s).

Details here: TRUNCATE @ postgresql.org

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)