Subject Re: [firebird-support] FK's and NULL
Author Helen Borrie
At 08:09 AM 27/10/2004 +1000, you wrote:


>Hi,
>
>This is a question for Helen, as I have been reading her Book, and I am not
>sure I understand the following statement:
>
>"...the foreign key corresponding to the old parent PK is set to null

When the "parent" row is deleted, any rows referring to it via the foreign
key ("dependent rows") will have their foreign key column(s) set to null.

> - the dependent rows become orphans.

Orphan = a "dependent" row that has no parent key.

>Clearly, this action trigger can not be applied if the foreign key column
>is non-nullable..." page 302

A non-nullable column is one that is constrained to be NOT NULL. So, you
can't apply the ON DELETE SET NULL. or ON UPDATE SET NULL action to a
foreign key that includes any NOT NULL columns.

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