Ravinder Reddy wrote:

    hi all,
        w.r.t DERBY-2945(convert lang/primarykey.sql to junit)
I have a small doubt.

There is a test for verifying a unique key can not contain nulls.

1)-- verify that a unique key can not contain nulls
  create table pos1 (c1 int not null unique, c2 int);
  insert into pos1 (c1) values(null);
  insert into pos1 (c1) values(null);
  select * from pos1;
  drop table pos1;
    And It tests that null values are not allowed in c1.
Irrespective of uniqueness , c1 can't contain null values as it is defined as not null.It seems that the test is wrong.
The test seems reasonable enough, but I guess it is really testing that not null works #:)
We could have a test like the one below if we don't have one already.
ij> create table pos1 (c1 int unique, c2 int);
ERROR 42831: 'C1' cannot be a column of a primary key or unique key because it can contain null values.

2) I am shocked to know that Derby doesn't allow a unique key column to contain NULL values.can some somebody justify it.?

You are easily shocked #:)


Kathey


Reply via email to