Match Full on foreign Key

From: sl26(at)ukc(dot)ac(dot)uk (Marc Richards)
To: pgsql-general(at)postgresql(dot)org
Subject: Match Full on foreign Key
Date: 2003-02-09 17:26:30
Message-ID: 8a5911e.0302090926.46a657c2@posting.google.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

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.

Responses

Browse pgsql-general by date

  From Date Subject
Next Message Neil Conway 2003-02-09 20:36:35 Re: PGconn timeout
Previous Message Marcelo Pereira 2003-02-09 16:59:16 PostgreSQL x Oracle