Bug #11121 | Foreign key constraints referencing a table that has not yet been created | ||
---|---|---|---|
Submitted: | 6 Jun 2005 20:58 | Modified: | 13 Jun 2005 19:23 |
Reporter: | Al Willingham | Email Updates: | |
Status: | Closed | Impact on me: | |
Category: | MySQL Migration Toolkit | Severity: | S2 (Serious) |
Version: | 1.0.7 Beta | OS: | Windows (Windows XP) |
Assigned to: | CPU Architecture: | Any |
[6 Jun 2005 20:58]
Al Willingham
[7 Jun 2005 5:42]
Jan Lindström
You can disable foreign key checks with set foregin_key_checks = 0;. If set to 1 (the default), foreign key constraints for InnoDB tables are checked. If set to 0, they are ignored. Disabling foreign key checking can be useful for reloading InnoDB tables in an order different than that required by their parent/child relationships. For example: mysql> set foreign_key_checks = 0; Query OK, 0 rows affected (0.05 sec) mysql> CREATE TABLE `wrlscarr` ( `networkcompid` BIGINT(10) NOT NULL, `networkid` BIGINT(10) NULL, `comments` VARCHAR(255) NULL, `nettype2compid` BIGINT(10) NOT NULL, PRIMARY KEY (`networkcompid`), CONSTRAINT `fk_net2comp` FOREIGN KEY `fk_net2comp` (`networkid`) REFERENCES `wrlscarr`.`operator2network` (`networkid`) ) ENGINE = INNODB; Query OK, 0 rows affected (0.23 sec)
[8 Jun 2005 3:34]
KimSeong Loh
Please reopen this. The foreign key check is disabled for the data insertion sql file, but is not disabled in the table creation sql file. The Create Object Online did disable the foreign key checks but the sql script did not have the foreign key checks disabled.
[13 Jun 2005 19:23]
Michael G. Zinner
Thank you for your bug report. This issue has been committed to our source repository of that product and will be incorporated into the next release. If necessary, you can access the source repository and build the latest available version, including the bugfix, yourself. More information about accessing the source trees is available at http://www.mysql.com/doc/en/Installing_source_tree.html