You are viewing a plain text version of this content. The canonical link for it is here.
Posted to derby-user@db.apache.org by adedayo damilola <om...@yahoo.co.uk> on 2007/08/16 15:05:27 UTC

Concerning UNIQUE keys

After reading the Derby document(s) I discovered that the UNIQUE constraint in Derby does not allow NULL values to be inserted into a cloumn with the constraint applied. So I was wondering if there was another way to achieve since the UNIQUE constraint was designed to do this 

       
---------------------------------
 Yahoo! Answers - Get better answers from someone who knows. Tryit now.

Re: Concerning UNIQUE keys

Posted by "Bernt M. Johnsen" <Be...@Sun.COM>.
>>>>>>>>>>>> adedayo damilola wrote (2007-08-16 14:05:27):
> After reading the Derby document(s) I discovered that the UNIQUE
> constraint in Derby does not allow NULL values to be inserted into a
> cloumn with the constraint applied. So I was wondering if there was
> another way to achieve since the UNIQUE constraint was designed to
> do this

UNIQUE on nullable columns is optional feature T591 in the SQL
standard and is not implemented in Derby.

There is some work going on and there is a fair chance that this will
be implemented for the next release.

If you want to achieve an enforcement of an unique constraint by other
means, I think it is possible to do it with a trigger, but it will not
be very performant.

-- 
Bernt Marius Johnsen, Database Technology Group, 
Staff Engineer, Technical Lead Derby/Java DB
Sun Microsystems, Trondheim, Norway