8.0.5 Bug in unique indexes?

From: "Joshua D(dot) Drake" <jd(at)commandprompt(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: 8.0.5 Bug in unique indexes?
Date: 2006-01-19 06:34:42
Message-ID: 43CF3302.2080306@commandprompt.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Hello,

Odd problem with unique indexes:

8.0.5 64 bit (Quad Opteron)

100 tables, each table has same layout, 1 million rows per table. The
problem persists within multiple tables
but only within the set of 100 tables.

I have a composite unique key on each table:

"uniq1" UNIQUE, btree (unit_id, email)

Performing a query like the following:

app=# select unit_id, email, count(*) as cnt from leads10 group by
unit_id, email having count(*) > 1;
unit_id | email | cnt
---------+------------------------+-----
77212 | robob(at)foo(dot)com | 2

app=# select unit_id,email from leads10 where unit_id = 77212 and email
= 'robob(at)foo(dot)com';
unit_id | email
---------+------------------------
77212 | robob(at)foo(dot)com
(1 row)

app=# reindex index "uniq1";
ERROR: could not create unique index
DETAIL: Table contains duplicated values.
app=#

I have verified that we have not overrun the fsm pages and that vacuums
are running daily (actually twice a day).
I have also ran a vacuum full on the various tables to no avail, no
error but the situation does not improve.

app=# set enable_indexscan = off;
SET
app=# select unit_id,email from leads10 where unit_id = 77212 and email
= 'robob(at)foo(dot)com';
unit_id | email
---------+------------------------
77212 | robob(at)foo(dot)com
77212 | robob(at)foo(dot)com
(2 rows)

app=# select lead_id,unit_id,email from leads10 where unit_id = 77212
and email = 'robob(at)foo(dot)com';
lead_id | unit_id | email
----------+---------+------------------------
35867251 | 77212 | robob(at)foo(dot)com
35864333 | 77212 | robob(at)foo(dot)com
(2 rows)

Thoughts?

Joshua D. Drake

P.S. Should this go to -bugs?

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Greg Stark 2006-01-19 06:44:54 Re: Unique constraints for non-btree indexes
Previous Message Tom Lane 2006-01-19 05:06:41 Re: Surrogate keys (Was: enums)