MySQL 5.5 外键不能引用分区表主键
版本
Server version: 5.5.15-rel21.0 Percona Server with XtraDB (GPL), Release rel21.0, Revision 158
ALTER TABLE `zabbix`.`alerts`
ADD CONSTRAINT `c_alerts_7` FOREIGN KEY (`eventid`) REFERENCES `zabbix`.`events`(`eventid`) ON DELETE CASCADE
报错ADD CONSTRAINT `c_alerts_7` FOREIGN KEY (`eventid`) REFERENCES `zabbix`.`events`(`eventid`) ON DELETE CASCADE
Error Code: 1005
Can't create table 'zabbix.#sql-5fd_5d8700' (errno: 150)
SHOW ENGINE INNODB STATUS出来的结果中:Can't create table 'zabbix.#sql-5fd_5d8700' (errno: 150)
121115 15:53:25 Error in foreign key constraint of table zabbix/#sql-5fd_5d8700:
foreign key (`eventid`) references `zabbix`.`events`(`eventid`) on delete Cascade:
Cannot resolve table name close to:
(`eventid`) on delete Cascade
foreign key (`eventid`) references `zabbix`.`events`(`eventid`) on delete Cascade:
Cannot resolve table name close to:
(`eventid`) on delete Cascade
events为分区表
检查过字段类型,长度,默认值,引擎,字符集都正常。
测试非分区表正常,难道这是一个BUG?