Return-Path: Delivered-To: apmail-db-derby-user-archive@www.apache.org Received: (qmail 72885 invoked from network); 13 Dec 2006 18:01:45 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Dec 2006 18:01:45 -0000 Received: (qmail 80370 invoked by uid 500); 13 Dec 2006 18:01:51 -0000 Delivered-To: apmail-db-derby-user-archive@db.apache.org Received: (qmail 80345 invoked by uid 500); 13 Dec 2006 18:01:51 -0000 Mailing-List: contact derby-user-help@db.apache.org; run by ezmlm Precedence: bulk list-help: list-unsubscribe: List-Post: List-Id: Reply-To: "Derby Discussion" Delivered-To: mailing list derby-user@db.apache.org Received: (qmail 80334 invoked by uid 99); 13 Dec 2006 18:01:51 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Dec 2006 10:01:51 -0800 X-ASF-Spam-Status: No, hits=1.9 required=10.0 tests=DNS_FROM_RFC_ABUSE,DNS_FROM_RFC_POST X-Spam-Check-By: apache.org Received-SPF: neutral (herse.apache.org: local policy) Received: from [32.97.182.141] (HELO e1.ny.us.ibm.com) (32.97.182.141) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 13 Dec 2006 10:01:39 -0800 Received: from d01relay04.pok.ibm.com (d01relay04.pok.ibm.com [9.56.227.236]) by e1.ny.us.ibm.com (8.13.8/8.12.11) with ESMTP id kBDI1CJk024066 for ; Wed, 13 Dec 2006 13:01:12 -0500 Received: from d01av03.pok.ibm.com (d01av03.pok.ibm.com [9.56.224.217]) by d01relay04.pok.ibm.com (8.13.6/8.13.6/NCO v8.1.1) with ESMTP id kBDI1C3A222866 for ; Wed, 13 Dec 2006 13:01:12 -0500 Received: from d01av03.pok.ibm.com (loopback [127.0.0.1]) by d01av03.pok.ibm.com (8.12.11.20060308/8.13.3) with ESMTP id kBDI1CxS014520 for ; Wed, 13 Dec 2006 13:01:12 -0500 Received: from [127.0.0.1] (IBM-IKEJ04B1IMA-009072133083.usca.ibm.com [9.72.133.83]) by d01av03.pok.ibm.com (8.12.11.20060308/8.12.11) with ESMTP id kBDI1Bpo014415 for ; Wed, 13 Dec 2006 13:01:12 -0500 Message-ID: <45803FE3.40102@sbcglobal.net> Date: Wed, 13 Dec 2006 10:01:07 -0800 From: Mike Matrigali Reply-To: mikem_app@sbcglobal.net User-Agent: Mozilla Thunderbird 1.0 (Windows/20041206) X-Accept-Language: en-us, en MIME-Version: 1.0 To: Derby Discussion Subject: Re: unique columns must be nullable ? References: <457EEDCD.2070301@sbcglobal.net> <457F294A.7000300@nuix.com> <457F4947.3050408@sbcglobal.net> In-Reply-To: Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit X-Virus-Checked: Checked by ClamAV on apache.org > > > What would break if we "simply" change this such that NULL always > compares not equal with all other values including NULL? > > Aside from a number of test cases for this particular case... > > Craig > "not equal" would not work for the btree. It needs a reproducible ordering for all key columns so that it can reliably find a particular key value - this is a recovery requirement. If someone is interested in supporting this, I think the easiest solution which would not affect current index performance would be to internally create "non-unique" indexes for nullable constraints and at insert time check if the key exists in the btree if it is not null and throw the exception from higher up than it is now. One could somehow special case this logic into the btree, but my worry is that the code then slows down/complicates all unique indexes for this one special case of allowing 2 nulls.