Subject RE: [firebird-support] FK's and NULL
Author Helen Borrie
At 12:43 PM 28/10/2004 +1000, you wrote:

> > Even if there is a parent key that is NULL (which is allowed
> > on one row in the parent table if the referenced key is a
> > UNIQUE constraint), the nulled child rows still have no
> > parent, since (NULL==NULL) can never be true.
> >
> > ./heLen
> >
>Hi Helen
>Is it "legal" to define a table which contains FK's and these FK fields
>accept NULL? (the FK's are not part of the PK).

Of course. Foreign keys by nature are never meant to be unique, except
when enforcing a 1:1 relationship.

>As I am getting no errors from FB when I do this, as well as having unique
>constraints for the FK fields. I have also defined FK_Constraints so that on
>delete and update the result is cascade.

Well, that's one action rule, whereas ON DELETE | UPDATE SET NULL is a
(mutually exclusive) other. If you are using the CASCADE rules, then the
SET NULL rules don't apply, obviously...