db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Daniel John Debrunner (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-3330) provide support for unique constraint over nullable columns
Date Thu, 28 Feb 2008 16:41:51 GMT

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

Daniel John Debrunner commented on DERBY-3330:

Thanks for cleaning up the IndexDescriptor upgrade related code, makes it look much cleaner.

A minor issue I have that if needed can be handled after any patch is applied is the naming
in the code of the new style of unique index.

The common theme is "uniqueWhenNotNull", when I first looked at the code I thought this was
the other way around since for index definitions I tend to think of the DDL, not the row values.

   isUnique() is true for indexes where the columns are defined NOT NULL

   isUniqueWhenNotNull() is true for indexes where the columns are nullable (but unique when
the column values do not contain NULLs).

See how that can be confusing to code readers who see the code without having been immersed
in developing the code.

Not sure of a better name, re-writing to be a positive statement (always clearer) but still
referring to the values would be:

or a positive statement referring to the column types:

I think a change in name would be good for the long term readability of the code, again it
can be a follow on patch, fairly easy to do with IDE refactoring.

One more aside, it would be good to expand the definition of isUnique() and the current isUniqueWhenNotNull()
in IndexDescriptor to indicate any relationship between them, e.g. is isUnique() true if isUniqueWhenNotNull()
is true?

> 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:
>         Environment: all
>            Reporter: Anurag Shekhar
>            Assignee: Anurag Shekhar
>         Attachments: BTreeController.diff, db2Compatibility.diff, derby-3330-testcase.diff,
derby-3330.diff, derby-3330v10.diff, derby-3330v11.diff, derby-3330v12.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,
> 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.

View raw message