db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Øystein Grøvlen (JIRA) <j...@apache.org>
Subject [jira] Commented: (DERBY-2212) Add "Unique where not null" to create index
Date Tue, 23 Oct 2007 11:04:52 GMT

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

Øystein Grøvlen commented on DERBY-2212:

I agree that we should try to avoid incompatibilities with older releases, but I am just as
worried that a slightly different semantics for unique constraints and unique index will be
confusing to users  regardless of whether we add another syntax or not.  

Also, Derby will today not allow the explicit creation of an index if such an index already
has been implicitly created through the definition of a constraint.  How should this behave
if we keep the old index behavior?  Should we allow two different kinds of unique indexes
on the same columns?

With respect to upgrade, I assume that after soft upgrade only the  old type of unique indexes
should be created.
After hard upgrade, you should get the new behavior.  The question is whether we should replace
any of the old unique indexes with the  new type on  hard upgrade.  I am not sure I see any
good reasons for doing that.  Can not we leave it to the user to decide whether he/she wants
to drop and recreated them?

> 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:
>            Reporter: Oleksandr Alesinskyy
>            Assignee: Anurag Shekhar
>         Attachments: derby-2212preview.diff, derby-2212preview2.diff
> 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.

View raw message