[ 
https://issues.apache.org/jira/browse/DERBY-3330?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12560070#action_12560070
 ] 

Anurag Shekhar commented on DERBY-3330:
---------------------------------------

I am following Mike's approach ie internally unique constraint will 
be backed by no unique index but during insert, checking the 
immediate left and right slot to find duplicate (if there is no null 
in the new key). If a duplicate key is found it the insert will be rejected. 

I will be introducing a new attribute in BTree to tell the insert routine 
that its not a non unique index but almost unique index. New 
attribute in BTree will be a persistant attribute so the file system will 
not be compatible with the older versions and will require a hard upgrade 
routine to migrate the old indexes to new version.

While creating the constraint on a table with existing records 
merge short is perform to sort the keys before creating index. A 
new merge short class will be required to sort this almost unique 
index (allowing duplicates only if there is null in it).

> provide support for unique constraint over nullable columns
> -----------------------------------------------------------
>
>                 Key: DERBY-3330
>                 URL: https://issues.apache.org/jira/browse/DERBY-3330
>             Project: Derby
>          Issue Type: New Feature
>          Components: Store
>    Affects Versions: 10.4.0.0
>         Environment: all
>            Reporter: Anurag Shekhar
>            Assignee: Anurag Shekhar
>
> Allow unique constraint over nullable field. Right now derby support unique 
> constraint only over not null columns.

-- 
This message is automatically generated by JIRA.
-
You can reply to this email to add a comment to the issue online.

Reply via email to