I use SELECT lastval() to get wrong serial id after truncated the table.
when I truncate the table, I use SELECT lastval(), I got the wrong ID/
Try this:
TRUNCATE TABLE table_name RESTART IDENTITY CASCADE;