Subject | Re: [firebird-support] Re: Null Foreign Keys |
---|---|
Author | Martijn Tonies |
Post date | 2003-09-12T18:03:56Z |
Nando,
CREATE TABLE INDEX_TEST
(
C1 INTEGER
);
COMMIT;
CREATE UNIQUE ASC INDEX I_IND_TEST ON INDEX_TEST (C1);
COMMIT;
insert into index_test values (4);
-- works
insert into index_test values (null);
-- works
insert into index_test values (null);
-- works again!!
insert into index_test values (4);
-- fails with:
attempt to store duplicate value (visible to active transactions) in unique
index "I_IND_TEST"
Maybe it has something to do with many engines using indices to implement
constraints.
With regards,
Martijn Tonies
Database Workbench - the developer tool for InterBase & Firebird
Upscene Productions
http://www.upscene.com
> M> As far as I can remember, IB and Fb1 did allow one NULL into anDid a quick test ... which I should have done before, of course.
> M> unique INDEX, but not in a constraint. I might be wrong there though.
>
> no, not even one.
CREATE TABLE INDEX_TEST
(
C1 INTEGER
);
COMMIT;
CREATE UNIQUE ASC INDEX I_IND_TEST ON INDEX_TEST (C1);
COMMIT;
insert into index_test values (4);
-- works
insert into index_test values (null);
-- works
insert into index_test values (null);
-- works again!!
insert into index_test values (4);
-- fails with:
attempt to store duplicate value (visible to active transactions) in unique
index "I_IND_TEST"
> And, confusion between keys and indexes is surely one of the top 5misconceptions
> heard at database classes!True :-)
Maybe it has something to do with many engines using indices to implement
constraints.
With regards,
Martijn Tonies
Database Workbench - the developer tool for InterBase & Firebird
Upscene Productions
http://www.upscene.com