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

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

Thanks Mike for the review.

Looks like the earlier (before the follow up changes) sorter routine was doing 
right thing. 
if had same compare routine from UniqueSort with additional entry for non nulls 
at the beginning of comparison loop 

            if (i == colsToCompare - 1 && nonull)
                return 0;

So if the comparison has reached till the last entry (location) and there is no 
null found so far it will consider the rows as duplicate. If one of the part 
was null (nonull will be false) the it will go ahead and compare the location 
too. 

I will revert this change from the follow up patch and update sorting with 
comments in my new follow up patch. 

I will also try to come up with a good tests for scenario you explained. 



> provide support for unique constraint over keys that include one or more 
> 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
>         Attachments: BTreeController.diff, db2Compatibility-v2.diff, 
> db2Compatibility.diff, derby-3330-testcase.diff, 
> derby-3330-UpgradeTests.diff, derby-3330.diff, derby-3330_followup_1.diff, 
> derby-3330v10.diff, derby-3330v11.diff, derby-3330v12.diff, 
> derby-3330v13.diff, derby-3330v2.diff, derby-3330v3.diff, derby-3330v4.diff, 
> derby-3330v5.diff, derby-3330v6.diff, derby-3330v7.diff, derby-3330v8.diff, 
> derby-3330v9.diff, derbyall_report.txt, FunctionalSpec_DERBY-3330-V2.html, 
> FunctionalSpec_DERBY-3330.html, UniqueConstraint_Implementation.html, 
> UniqueConstraint_Implementation_V2.html, 
> UniqueConstraint_Implementation_V3.html, 
> UniqueConstraint_Implementation_V4.html
>
>
> Allow unique constraint over keys which include one or more nullable fields.  
> Prior to this change Derby only supported unique constraints on keys that 
> included no nullable columns.  The new constraint will allow unlimited 
> inserts of any key with one more null columns, but will limit insert of keys 
> with no null columns to 1 unique value per table.
> There is no change to existing or newly created unique indexes on null 
> columns (as opposed to unique constraints on null columns).  Also there is no 
> change to existing or newly created constraints on keys with no nullable 
> 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