index help for uuid datatype

From: Gevik Babakhani <pgdev(at)xs4all(dot)nl>
To: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: index help for uuid datatype
Date: 2006-09-16 16:34:49
Message-ID: 1158424489.10117.15.camel@voyager.truesoftware.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I am testing the uuid datatype with unique indexing.
I have the following script to generate a table with uuid types:

create table guid(
pk uuid primary key default new_guid(),
f1 varchar(38)
);

insert into guid(f1) values('bla bla');
insert into guid(f1) values('bla bla');

insert into guid(f1) select f1 from guid;

-- I repeat the insert above 10 times to get may records.

-- then save the generated guid into the varchar field
update guid set f1=pk;

-- check for duplicates in the varchar field
select f1,count(*) from guid group by f1 having(count(f1) > 1);

-- no duplicates there:

f1 | count
----+-------
(0 rows)

-- and here it comes.........
dev=# create unique index idx1 on guid using btree (pk);
ERROR: could not create unique index
DETAIL: Table contains duplicated values.

I must be doing something very wrong.....
Does anyone ever seen such a thing?

Regards,
Gevik.

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2006-09-16 16:43:19 Re: index help for uuid datatype
Previous Message Tom Lane 2006-09-16 16:24:04 Re: [HACKERS] New XML section for documentation