Re: Primary key duplicates - Mailing list pgsql-bugs

From Tom Lane
Subject Re: Primary key duplicates
Date
Msg-id 26276.1092425882@sss.pgh.pa.us
Whole thread Raw
In response to Primary key duplicates  (Zeki Mokhtarzada <zeki@freewebz.com>)
Responses Re: Primary key duplicates
List pgsql-bugs
Zeki Mokhtarzada <zeki@freewebz.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

pgsql-bugs by date:

Previous
From: Tom Lane
Date:
Subject: Re: OpenBSD 3.5, PostgreSQL 8.0.0beta1 make fails
Next
From: Tom Lane
Date:
Subject: Re: 8.0 beta1: pg_dump/restore failing