duplicate key

Sun, May 26, 2002

A quiet little Memorial Day Sunday so far. Had a fun problem with Postgres yesterday. Here's a little ditty on what to do when you get the nasty "duplicate key" error message, and you know it's wrong.

Postgresql index - What to do when a Postgresql index count is wrong

I had an interesting circumstance happen with Postgres (PostgreSQL) and I want to remember how I fixed the problem.

Somehow I had four entries in a database table, but the key for that table thought that there were only two entries. I don't yet know how this happened, but at the time I didn't care, I just needed to get past the problem. The details of the problem, and the fix, follow.

In my case the table name was carrier, and this table and the key were created like this:

Syndicate content