How-to: How to reset postgres' primary key sequence when it falls out of sync? #computers #dev #it
How-to: How to reset postgres' primary key sequence when it falls out of sync? #computers #dev #it
How to reset postgres’ primary key sequence when it falls out of sync?
I ran into the problem that my primary key sequence is not in sync with my table rows.
That is, when I insert a new row I get a duplicate key error because the sequence implied in the serial datatype returns a number that already exists.
It seems to be caused by import/restores not maintaining the sequence properly.
Answer [by
View On WordPress
















