BUG #2379: Duplicate pkeys in table

From: "Philip Warner" <pjw(at)rhyme(dot)com(dot)au>
To: pgsql-bugs(at)postgresql(dot)org
Subject: BUG #2379: Duplicate pkeys in table
Date: 2006-04-06 06:29:29
Message-ID: 200604060629.k366TTYv083632@wwwmaster.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs


The following bug has been logged online:

Bug reference: 2379
Logged by: Philip Warner
Email address: pjw(at)rhyme(dot)com(dot)au
PostgreSQL version: 8.0.7
Operating system: FreeBSD
Description: Duplicate pkeys in table
Details:

We have an intermittent bug that occurs on a table which is updated several
times per second. The bug occurs every few days/weeks. It is usually
preceeded by a "tuple concurrently updated" messages, but I could not swear
it is always preceeded by it.

The result of the bug is demonstrated by:

select id,count(*) from xxx group by id having count(*)>1;
id | count
-------+-------
24613 | 6
(1 row)

(where ID is the pkey (and xxx is not the real table name)).

The row concerned is one of the most frequestly updated rows, and shows only
one row when I do a 'select * from xxx where id = 24613'.

If I do a select id from xxx order by id, I get 6 duplicate rows.

We have tried a reindex:

mail=# reindex table xxx;
ERROR: could not create unique index
DETAIL: Table contains duplicated values.

All of which seems to suggest that there really are 6 data rows with the
same pkey.

None of our code changes the pkey, but we do have several places that update
this table intriggers.

Any help or suggestions would be greatly appreciated.

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Paolo Lopez 2006-04-06 07:12:20 Re: Problema Order By en PosgreSQL 8.1
Previous Message Qingqing Zhou 2006-04-06 02:55:02 Re: BUG #2371: database crashes with semctl failed error