Re: BUG #3965: UNIQUE constraint fails on long column values

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Juho Saarikko <juhos(at)mbnet(dot)fi>, pgsql-bugs(at)postgresql(dot)org
Subject: Re: BUG #3965: UNIQUE constraint fails on long column values
Date: 2008-02-18 22:25:46
Message-ID: 10241.1203373546@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs pgsql-docs

Bruce Momjian <bruce(at)momjian(dot)us> writes:
> Juho Saarikko wrote:
>> While I didn't test, I'd imagine that this would also mean that any attempt
>> to insert such values to an already unique column would fail.

> Works here in 8.3:

> test=> create table test (x text unique);
> NOTICE: CREATE TABLE / UNIQUE will create implicit index "test_x_key" for table "test"
> CREATE TABLE
> test=> insert into test values (repeat('a', 50000));
> INSERT 0 1

That test only works because it's eminently compressible.

The short answer to this bug report is that we're not very concerned
about fixing this because there is seldom a good reason to have an
index (unique or not) on fields that can get so wide. As was already
noted, if you do need a uniqueness check you can easily make a 99.9999%
solution by indexing the md5 hash (or some similar digest) of the
column. It doesn't really seem worthwhile to expend development work
on something that would benefit so few people.

regards, tom lane

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Juho Saarikko 2008-02-18 23:21:11 Re: BUG #3965: UNIQUE constraint fails on long column values
Previous Message Bruce Momjian 2008-02-18 22:12:28 Re: BUG #3965: UNIQUE constraint fails on long column values

Browse pgsql-docs by date

  From Date Subject
Next Message Juho Saarikko 2008-02-18 23:21:11 Re: BUG #3965: UNIQUE constraint fails on long column values
Previous Message Bruce Momjian 2008-02-18 22:12:28 Re: BUG #3965: UNIQUE constraint fails on long column values