Re: how could duplicate pkey exist in psql? - Mailing list pgsql-general

From hubert depesz lubaczewski
Subject Re: how could duplicate pkey exist in psql?
Date
Msg-id 20111117122824.GD7623@depesz.com
Whole thread Raw
In response to how could duplicate pkey exist in psql?  (Yan Chunlu <springrider@gmail.com>)
List pgsql-general
On Thu, Nov 17, 2011 at 01:19:30PM +0800, Yan Chunlu wrote:
> recently I have found several tables has exactly the same pkey,  here is
> the definition:
> "diggcontent_data_account_pkey" PRIMARY KEY, btree (thing_id, key)

please check:
select thing_id, key, count(*) from diggcontent_data_account group by 1,2 having
count(*) > 1;

this will show if you have really duplicated values.

if you have - the index ( diggcontent_data_account_pkey ) is broken.
Exact reason can vary, any chance this database is hot-backup restored
from different system?

Best regards,

depesz

--
The best thing about modern society is how easy it is to avoid contact with it.
                                                             http://depesz.com/

pgsql-general by date:

Previous
From: hubert depesz lubaczewski
Date:
Subject: Re: How could I find the last modified procedure in the database?
Next
From: "Anibal David Acosta"
Date:
Subject: checkpoints are occurring too frequently