pt-online-schema-change outputs "child_table has no foreign key constraints referencing _parent_table_old" when a child_table has multiple foreign keys referencing to the parent_table
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Percona Toolkit moved to https://jira.percona.com/projects/PT |
New
|
Undecided
|
Unassigned |
Bug Description
When I alter table with rebuilding multiple foreign keys on one child table, which reference the parent table to be altered, by using option "--alter-
- Parent table definition which is altered by pt-online-
=======
CREATE TABLE `parent` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
PRIMARY KEY (`id`)
) ENGINE=InnoDB;
=======
- Child table definition which has multiple foreign keys referencing the parent table
=======
CREATE TABLE `child` (
`id` int(10) unsigned NOT NULL AUTO_INCREMENT,
`parent_id` int(10) unsigned NOT NULL,
`merged_
PRIMARY KEY (`id`),
KEY `child_IX1` (`parent_id`),
KEY `child_IX2` (`merged_
CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`) ON DELETE CASCADE ON UPDATE CASCADE,
CONSTRAINT `child_ibfk_2` FOREIGN KEY (`merged_
) ENGINE=InnoDB;
=======
- Complete command‐line used to run the tool
=======
/usr/bin/
--nodrop-old-table --ask-pass \
--alter-
--alter 'ADD COLUMN `column` int(11) unsigned' \
h=host, D=database, t=parent, u=pt-osc \
--dry-run \
=======
- Tool version
pt-online-
- MySQL version of all servers involved
5.6
- Output from the tool including STDERR
=======
Swapping tables...
Swapped original and new tables OK.
Rebuilding foreign key constraints...
`database`.`child` has no foreign key constraints referencing `database`
Rebuilt foreign key constraints OK.
=======
description: | updated |
Hi,
Could you clarify which table are you trying to alter? parent or child?
The command line you posted says 'table'