db-derby-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Mike Matrigali <mikem_...@sbcglobal.net>
Subject Re: unique columns must be nullable ?
Date Wed, 13 Dec 2006 18:01:07 GMT

> 
> 
> 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.


Mime
View raw message