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

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

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

Even this works:

test=> insert into test values (repeat('a', 50000) || 'b');

I believe the index only indexes 8192 bytes but checks the heap for
longer values to check the full length.

--
Bruce Momjian <bruce(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://postgres.enterprisedb.com

+ If your life is a hard drive, Christ can be your backup. +

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Tom Lane 2008-02-18 22:25:46 Re: BUG #3965: UNIQUE constraint fails on long column values
Previous Message Faheem Mitha 2008-02-18 22:03:21 BUG #3968: ssh tunnel instructions could use improvement

Browse pgsql-docs by date

  From Date Subject
Next Message Tom Lane 2008-02-18 22:25:46 Re: BUG #3965: UNIQUE constraint fails on long column values
Previous Message Gregory Stark 2008-02-18 15:29:44 Re: BUG #3965: UNIQUE constraint fails on long column values