You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-dev@db.apache.org by "Mike Matrigali (JIRA)" <ji...@apache.org> on 2008/10/10 19:45:44 UTC

[jira] Updated: (DERBY-2212) Add "Unique where not null" to create index

     [ https://issues.apache.org/jira/browse/DERBY-2212?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Mike Matrigali updated DERBY-2212:
----------------------------------


DERBY-3330 has been implemented which provides the SQL standard unique constraint which allow multiple nulls.  I do not believe anyone is currently working on providing the "Unique where not null"
syntax to create index.  The same behavior as creating the index can be achieved by using the alter
table add constraint syntax.

If anyone needs this, the project would not be too hard as it would be mostly a parser project, and of
course new testing and possible changes of existing tests.  The underlying technology to support such an index has been implemented as part of DERBY-3330.

The consensus at the time of DERBY-3330 implementation was to avoid breaking existing applications,
and continue to support the existing behavior of DERBY unique indexes (ie. only allowing a single null),
unless a user used a new syntax that specifically called for multiple nulls.  DERBY-3330 enabled the
contraint case as that was a SQL standard, and did not implement the create index syntax as it seemed
redundant to provide 2 different ways to do the same thing.

> Add "Unique where not null" to create index
> -------------------------------------------
>
>                 Key: DERBY-2212
>                 URL: https://issues.apache.org/jira/browse/DERBY-2212
>             Project: Derby
>          Issue Type: Improvement
>          Components: SQL
>    Affects Versions: 10.2.1.6
>            Reporter: Oleksandr Alesinskyy
>         Attachments: derby-2212preview.diff, derby-2212preview2.diff, FunctionalSpec.html, FunctionalSpecV3.html, FunctionalSpecV3_comment.html, FunctionlaSpecv2.html
>
>
> Derby prohibits creation of unique constraints on nullable colums (as well if only some columns in the constraint list are nullable) and treat nulls in unique indexes as normal values (i.e. only one row with null values in indexed columns may be inserted into the table). This bahavior is very restrictive, does not completely comply with SQL standards (both letter and intent) as well as with business needs and intending meaning of NULL values (2 null values are not considered as equal, this comparision shall return NULL, and for selection criteria boolean null is treated as FALSE).
> This behavior, as far as I can see, is modelled after DB2 (and differs from behavior of most other major databases, like SyBase, Oracle, etc.).
> But even DB2 provide some means to alleviate these restrictions, namely "UNIQUE WHERE NOT NULL" clause for CREATE INDEX statement.
> It will be very good if such "UNIQUE WHERE NOT NULL" clause will be introduced in Derby.
> Regards,
> Oleksandr Alesinskyy

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