=?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