Details
-
Type:
Task
-
Status: Closed
-
Priority:
Minor
-
Resolution: Won't Fix
-
Fix Version/s: N/A
-
Component/s: None
-
Labels:
Description
After all these years, sometimes I still see people who use the REFERENCES syntax to create foreign keys:
col_name col_type REFERENCES tab_name (col_name)
The problem is that they may think that a foreign key is created, until they realize that data is inconsistent.
Please, consider producing a warning when this syntax is used. Or maybe support the syntax.
Gliffy Diagrams
Attachments
Activity
- All
- Comments
- Work Log
- History
- Activity
- Transitions
There is no good way to do it. MariaDB does not support foreign keys yet. InnoDB works around it by parsing the CREATE TABLE statement with the internal parser and extracting foreign key definitions from there.
To support REFERENCES one needs to extend InnoDB to parse that syntax too. To issue a warning MariaDB needs to become aware that some engines parse CREATE TABLE and implement foreign keys internally. It needs to know what engines can do it, when an engine does it, and what exactly syntax is supports. There is no API for that, we never wanted to require the engine to implement an SQL parser internally.