Re: Duplicate rows sneaking in despite PRIMARY KEY / UNIQUE constraint

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Travis Cross <travis(at)crosswirecorp(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Duplicate rows sneaking in despite PRIMARY KEY / UNIQUE constraint
Date: 2006-06-06 14:19:42
Message-ID: 16881.1149603582@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Travis Cross <travis(at)crosswirecorp(dot)com> writes:
> I'm noticing that a handful (4-16) of rows with duplicate columns
> (uid,token) are sneaking into the table every day despite the
> primary key constraint.

Corrupt index, looks like ... you might try reindexing the index.

I don't believe that the PANIC you show has anything directly to do
with duplicate entries. It is a symptom of corrupt index structure.
Now a corrupt index might also explain failure to notice duplications,
but changing your application isn't going to fix whatever is causing
it. You need to look for server-side causes.

Any database or system crashes on this server (before this problem
started)? Do you *know* that the disk drive will not lie about write
complete? What is the platform and storage system, anyway?

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-06-06 14:27:53 Re: fillfactor using WITH syntax
Previous Message Martijn van Oosterhout 2006-06-06 14:03:43 Re: That EXPLAIN ANALYZE patch still needs work