Thread: Match Full on foreign Key

Match Full on foreign Key

From
sl26@ukc.ac.uk (Marc Richards)
Date:
I have defined the following foreign keys in a table:

*********
FOREIGN KEY (staff_login) REFERENCES staff (staff_login) MATCH FULL ON
DELETE CASCADE ON UPDATE CASCADE,

    FOREIGN KEY (module_code) REFERENCES module (module_code) MATCH FULL
ON DELETE CASCADE ON UPDATE CASCADE,
*********

these two fields make the primary key of the table in which they are
in.

MATCH FULL will not allow one column of a multi-column foreign key to
be NULL unless all foreign key columns are NULL...so:

*If an entry is made in "staff_login" from the "staff" table that it
references, then "module_code" will be empty until the user enters a
value for that field in the "module" table.  Will having MATCH FULL on
*both* keys present problems them when users fill in their details?
Should I just have MATCH FULL on one field or even on none at all and
have my web application (which feeds data into the DB) check this
instead?

Comments appreciated,
Cheers.