Skip site navigation (1) Skip section navigation (2)

Peripheral Links

Header And Logo

PostgreSQL
| The world's most advanced open source database.

Site Navigation

Search archives
  Advanced Search

Match Full on foreign Key



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.



Home | Main Index | Thread Index

Privacy Policy | PostgreSQL Archives hosted by Command Prompt, Inc. | Designed by tinysofa
Copyright © 1996 – 2008 PostgreSQL Global Development Group