Mysqldbcopy joining foreign key constraints?

So, I currently have a table with the following constraints as per SHOW CREATE TABLE

:

CONSTRAINT `FK_BA62400997790DEE` FOREIGN KEY (`some_id`) REFERENCES `Other_Table` (`id`),
CONSTRAINT `FK_BA624009C8554709` FOREIGN KEY (`someOther_id`) REFERENCES `Yet_Another_Table` (`id`)

      

However, when using mysqldbcopy

db to copy, I get the following error:

ALTER TABLE old_database.OriginalTable add CONSTRAINT `FK_BA62400997790DEE`
FOREIGN KEY (`some_id`,`someOther_id`)
REFERENCES `old_database`.`Other_Table`
(`id`,`id`)
ON UPDATE RESTRICT
ON DELETE RESTRICT
. Error: Query failed. 1005 (HY000): Can't create table 'old_database.#sql-602_4b5' (errno: 150)

      

Something is clearly wrong here, but not sure what it is. Is it clear that this is somehow trying to match the keys?

I am running version 1.3.5.

+3


source to share


2 answers


The 1.3.6 release fixes the following bug that may be related to

BUG#17474810: constraint error copying the employees with mysqldbcopy

      



Try to upgrade to something higher, currently up to version 1.6 - https://launchpad.net/mysql-utilities

+4


source


I am using MySQL Utilities mysqldbcopy version 1.6.5, it still shows me something like this:

ERROR: Unable to execute constraint query
ALTER TABLE node5.books add CONSTRAINT `books_ibfk_1`
FOREIGN KEY (`publisher_id`)
REFERENCES `node5`.`publishers`
(`id`)
ON UPDATE RESTRICT
ON DELETE RESTRICT
. Error: Query failed. 1215 (HY000): Cannot add foreign key constraint

      



And then I found that installing a storage engine for InnoDB can fix this problem.

https://github.com/maghead/maghead/commit/b406abf277b525f665966f8e8ec421a229bb13c7

+1


source







All Articles