Hi,

I was looking at the CREATE TABLE syntax and I saw this reference definition 
for InnoDB tables:


reference_definition:
REFERENCES tbl_name [(index_col_name,...)]
[MATCH FULL | MATCH PARTIAL | MATCH SIMPLE]
[ON DELETE reference_option]
[ON UPDATE reference_option]

reference_option:
RESTRICT | CASCADE | SET NULL | NO ACTION

Well, I pretty undestood all but I can't understand 2 things about MATCH 
option:

1. Which of three options (SIMPLE, FULL, PARTIAL) are implemented in the 
current production version of MySQL? Reading around, I think SIMPLE and FULL 
are supported. What about PARTIAL? Is it supported?

2. About MATCH PARTIAL. I could not find a good explanation on how it works. I 
found here http://forge.mysql.com/wiki/ForeignKeySupport the explanations on 
MATCH SIMPLE and MATCH FULL:

--------------QUOTED-------------

Handling of the the MATCH clause -- The HLS specifies that support for MATCH 
SIMPLE only is required. Since it is very easy to support MATCH FULL if we 
already have support for MATCH SIMPLE, MATCH FULL should perhaps be added to 
the list of requirements as an optional feature. These types of the MATCH 
clause differ only in case of checks that are done during insertion into a 
referencing table.

So they can be implemented by a simple check which is to be done at the 
beggining of the trigger which is responsible for processing of a foreign key 
check on insertion:

* if the match type is SIMPLE and one or more foreign key columns in the row 
being inserted is NULL, then regard the constraint as satisified. Otherwise 
continue with checking.
* if the match type for the foreign key constraint is FULL and all foreign key 
columns in the row being inserted are NULL, then treat the constraint as 
satisified. If at least one of columns in the foreign key is NULL, and at 
least one of them is not NULL, treat the foreign key constraint as failed. 
Otherwise (if all columns in the foreign key are not NULL), continue with 
checking.

Handling of foreign key constraints with MATCH PARTIAL is more complex and 
support for it is not required in the HLS.

------------END QUOTED-------------

But there's no explanation about MATCH PARTIAL.

So, what about MATCH PARTIAL. Is it supported and how does it works?

Thanks for any infos.

Giorgio

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to