Skip to content Skip to sidebar Skip to footer

Major Bug In Mysql 8.x? -- Foreign Keys

While retrieving foreign keys information from MySQL (for a code generator) I noticed this strange behavior. It looks like a major bug in MySQL 8.x. When I create a foreign key usi

Solution 1:

Not fixed in MySQL. It permits legal SQL syntax, but MySQL does not save the constraint when using the column-level foreign key syntax.

This was reported as a bug in 2005, and closed with a "won't fix" message.

https://bugs.mysql.com/bug.php?id=13301

https://dev.mysql.com/doc/refman/8.0/en/ansi-diff-foreign-keys.html says:

MySQL parses but ignores “inline REFERENCES specifications” (as defined in the SQL standard) where the references are defined as part of the column specification. MySQL accepts REFERENCES clauses only when specified as part of a separate FOREIGN KEY specification. For storage engines that do not support foreign keys (such as MyISAM), MySQL Server parses and ignores foreign key specifications.

There is no way to disable the unsupported syntax, or even to make it return an error or a warning.

Post a Comment for "Major Bug In Mysql 8.x? -- Foreign Keys"