Postgres sequence

Postgres’ sequence is similar to MySQL’s auto increment IDs. Once in a while, you may get this error: duplicate key value violates unique constraint “your_primary_key” Basically, that means postgres is trying to insert a new record to a table, but fails because there is already a row having the same new ID. But how can that be? You may ask. Chances are that your insert statement doesn’t even have the auto-increment ID! ...

January 18, 2013 · 1 min · birdchan