Search code examples
mysqlinformation-schema

What is the match_option column in REFERENTIAL_CONSTRAINTS table of mysql information schema?


I'm trying to find out relations between different tables in a data base by using a script which will look into REFERENTIAL_CONSTRAINTS table in mysql information_schema.

Can somebody explain what the match_option column in REFERENTIAL_CONSTRAINTS table of mysql information schema used for.

In my data base it is always NONE. Only information regarding this I was able to find from mysql documentation regarding this is a statement saying that The only valid value at this time for MATCH_OPTION is NONE.. If that is the case then why do we need such a column?


Solution

  • This answer explains the use of MATCH FULL, MATCH PARTIAL, and MATCH SIMPLE for Postgres and it's same for other databases.

    MATCH FULL, MATCH PARTIAL, and MATCH SIMPLE are allowed in MATCH_OPTION, but their use should be avoided, as they cause the MySQL Server to ignore any ON DELETE or ON UPDATE clause used in the same statement. MATCH options do not have any other effect in MySQL, which in effect enforces MATCH SIMPLE semantics full-time.

    Refer 1.8.3.2 MySQL FOREIGN KEY Constraints.

    Also refer this 13.1.15.3 Using FOREIGN KEY Constraints