A bug with unique indicies - Mailing list pgsql-hackers

From Aditya Damle
Subject A bug with unique indicies
Date
Msg-id 3A666114.D9F4B2C5@2028.com
Whole thread Raw
Responses Re: A bug with unique indicies  (Tom Lane <tgl@sss.pgh.pa.us>)
List pgsql-hackers
Hello. Hopefully, this is the right mailing list to send
this type of question too.

System:
I am running the newest 7.03 build on a dual 866 Pentium III
with a 128M raid card.

I have found an error that is quite odd.
I have a table that is supposed to keep a map between
urls and ids. Each url in the table should be unique.
Thus I have

Create table "urlmap" (   "url" text not NULL,   "id" int4 not NULL,   PRIMARY KEY ("url"),   UNIQUE ("id","url") );

After inserting a number of urls (via spidering) i did the following.

I vacuumed the db : vacuum verbose analyze.

First:
select * from urlmap where url='blah blah';

Here I got back only one row. Good.

Then i went ahead reindexed the table: I recieved the error:
Cannot create unique index. Table contains non-unique values.

Same problem occurs if I drop the indicies and try to recreate them.

I then :
select * from urlmap u1,urlmap u2 where u1.url=u2.url and u1.oid!=u2.oid

I then got back two rows where the url was indeed the same and the
associated id
different. Why, would this ever occur?

-Aditya



pgsql-hackers by date:

Previous
From: Tom Lane
Date:
Subject: Re: palloc? (re: What's with update?)
Next
From: Tom Lane
Date:
Subject: Re: Changes to include files