Re: Table with seemingly duplicated primary key values

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Aleksander Łukasz <allllllx(at)gmail(dot)com>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: Table with seemingly duplicated primary key values
Date: 2015-12-22 15:33:24
Message-ID: 13281.1450798404@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

=?UTF-8?Q?Aleksander_=C5=81ukasz?= <allllllx(at)gmail(dot)com> writes:
> a table in our database with about 3 million rows ended up in a state
> where its seems to have duplicated entries (duplicated primary key values):
> ...
> Do you have any idea what could be happening and what measures should be
> undertaken to fix this issue? Thanks.

Looks like corruption of the primary key index. Try REINDEXing that
index. This might fail if there actually are duplicate rows in the table
and not just incorrect pointers to them in the index, in which case you'll
have to clean up the duplicates somehow and try again till the REINDEX
succeeds.

regards, tom lane

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Melvin Davidson 2015-12-22 15:34:09 Re: Table with seemingly duplicated primary key values
Previous Message Michael Paquier 2015-12-22 12:27:00 Re: Session Identifiers