db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Uwe Kubosch (JIRA)" <j...@apache.org>
Subject [jira] Commented: (DERBY-2212) Add "Unique where not null" to create index
Date Fri, 19 Dec 2008 22:36:46 GMT

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

Uwe Kubosch commented on DERBY-2212:
------------------------------------

I have reread the previous comment a dozen times, but I cannot understand what the solution
is.

DERBY-3330 made it into the released 10.4.2.0 version, right?

Could you please give an example of how to create a constraint equaling a unique index for
one or more nullable columns while still allowing multiple rows with the same values as long
as at least one value included in the constraint  in each row is NULL?  That is, the constraint
should only enforce uniqueness for rows where _all_ values in the columns included in the
constraint are non-null.

An example would make it clear how to solve the problem.  If there is further documentation
on this, please include a reference.


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


Mime
View raw message