Re: Primary key duplicates

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Zeki Mokhtarzada <zeki(at)freewebz(dot)com>
Cc: pgsql-bugs(at)postgresql(dot)org
Subject: Re: Primary key duplicates
Date: 2004-08-13 19:38:02
Message-ID: 26276.1092425882@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs

Zeki Mokhtarzada <zeki(at)freewebz(dot)com> writes:
> Notice that 3787433 is duplicated. How could this have happened if that
> column is flagged as the primary key. Even more interesting:

> select oid, fileid, userid from files where userid = 1898598 order by
> fileid;
> oid | fileid | userid
> ----------+---------+---------
> 1573737 | 3787433 | 1898598
> 1573737 | 3787433 | 1898598
> 1573820 | 3787563 | 1898598
> 18612041 | 9554275 | 1898598

It would be interesting to see the ctid, xmin, cmin, and xmax fields
as well.

> I suspect a corrupt index is at fault here.

Possibly, but the duplicate OID entries suggest that a row was updated
and then for some reason the old version appears to still be valid.
(Or an attempted update was rolled back, but the new version got marked
valid anyway.) Have you had any crashes or other strange behavior lately?

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2004-08-13 19:39:33 Re: OpenBSD 3.5, PostgreSQL 8.0.0beta1 make fails
Previous Message Andreas Pflug 2004-08-13 19:29:41 Re: PostgreSQL 8.0