Bug #19173 | Foreign Key reference integrity | ||
---|---|---|---|
Submitted: | 18 Apr 2006 18:19 | Modified: | 24 Feb 2007 19:39 |
Reporter: | Barry Quiel | Email Updates: | |
Status: | Verified | Impact on me: | |
Category: | MySQL Server: DML | Severity: | S4 (Feature request) |
Version: | 5.0.20 | OS: | Linux (Linux) |
Assigned to: | CPU Architecture: | Any |
[18 Apr 2006 18:19]
Barry Quiel
[18 Apr 2006 19:03]
MySQL Verification Team
Thank you for the bug report. Are you using InnoDB table engine as default engine? Otherwise please read: http://dev.mysql.com/doc/refman/5.0/en/create-table.html InnoDB tables support checking of foreign key constraints. See Section 14.2, “The InnoDB Storage Engine”. Note that the FOREIGN KEY syntax in InnoDB is more restrictive than the syntax presented for the CREATE TABLE statement at the beginning of this section: The columns of the referenced table must always be explicitly named. InnoDB supports both ON DELETE and ON UPDATE actions on foreign keys. For the precise syntax, see Section 14.2.6.4, “FOREIGN KEY Constraints”. For other storage engines, MySQL Server parses and ignores the FOREIGN KEY and REFERENCES syntax in CREATE TABLE statements. The CHECK clause is parsed but ignored by all storage engines. See Section 1.9.5.5, “Foreign Keys”. Thanks in advance.
[19 Apr 2006 18:24]
Barry Quiel
The InnoDB foreign key constraints do work correctly. The final database engine will be NDBCLUSTER. But when creating tables the default is MyISAM. I think its a bit odd that these engines would choose to ignore the foreign key constraints. I have downgraded this from S1 to S4 in the hopes that the inforcement of foreign key contstraints will be added to all the storage engines in the next release of 5.X
[24 Feb 2007 19:39]
MySQL Verification Team
Thank you for the bug report.