Received: from localhost (unknown [200.46.204.184]) by postgresql.org (Postfix) with ESMTP id 7BE1A2E003B for ; Mon, 18 Feb 2008 18:12:37 -0400 (AST) Received: from postgresql.org ([200.46.204.71]) by localhost (mx1.hub.org [200.46.204.184]) (amavisd-maia, port 10024) with ESMTP id 79564-06 for ; Mon, 18 Feb 2008 18:12:29 -0400 (AST) Received: from momjian.us (momjian.us [70.90.9.53]) by postgresql.org (Postfix) with ESMTP id DF0CA2E0043 for ; Mon, 18 Feb 2008 18:12:31 -0400 (AST) Received: (from bruce@localhost) by momjian.us (8.11.6/8.11.6) id m1IMCSD14587; Mon, 18 Feb 2008 17:12:28 -0500 (EST) From: Bruce Momjian Message-Id: <200802182212.m1IMCSD14587@momjian.us> Subject: Re: BUG #3965: UNIQUE constraint fails on long column values In-Reply-To: <200802181130.m1IBUNdu060026@wwwmaster.postgresql.org> To: Juho Saarikko Date: Mon, 18 Feb 2008 17:12:28 -0500 (EST) CC: pgsql-bugs@postgresql.org X-Mailer: ELM [version 2.4ME+ PL124 (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="US-ASCII" X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200802/165 X-Sequence-Number: 19732 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 http://momjian.us EnterpriseDB http://postgres.enterprisedb.com + If your life is a hard drive, Christ can be your backup. +