db-derby-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mike Matrigali (JIRA)" <j...@apache.org>
Subject [jira] Updated: (DERBY-2212) Add "Unique where not null" to create index
Date Fri, 19 Oct 2007 04:10:51 GMT

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

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


There are 2 discussions here.  Let's settle first what SQL level behavior is being implemented.
 I believe it is clear that the focus is to allow derby to create unique 
constraints on a set of columns where one or more of the columns is nullable.  This
is the SQL standard, and I don't see any backward compatiblity issues.  Many users have
asked for this and it adds to our standards implementation so seems like a good feature to
add to Derby.

My opinion is that we should not change the existing behavior for unique indexes.  Changing
the behavior presents possible application upgrade and backward compatibility issues.  The
change seems minor, but it has been my experience that no matter how small the behavior change
a number of applications will depend on it.  I don't think this is a SQL standard issue
as create index is an implementation specific ddl and is not covered.

I lean toward not providing extra syntax to create index to create the "new" multiple null
unique indexes as it just seems like another way to do the same thing you can do with a constraint.
 But I don't really feel strongly about this one.  If someone wanted to do it I would not
-1 it.  Historically I think alter table add constraint came after create index, so originally
one needed the create index command to add more unique indexes after the table was
created.

I do think the decision on support of old unique index may affect best internal implementation
details.  

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


Mime
View raw message