【发布时间】:2014-09-24 07:13:49
【问题描述】:
我正在尝试重命名 InnoDB 表中的主键,但一直收到 Errno 150。SHOW INNODB STATUS 显示:
LATEST FOREIGN KEY ERROR
130711 18:22:53 Error in foreign key constraint of table xx/client_location_business_load:
there is no index in referenced table which would contain
the columns as the first columns, or the data types in the
referenced table do not match the ones in table. Constraint:
,
CONSTRAINT "business_load_business_load_name_key" FOREIGN KEY ("name_id") REFERENCES "client_businesstype_load_name" ("name_id") ON DELETE CASCADE ON UPDATE CASCADE
表client_location_business_load 甚至都不存在!它被重新命名。名为business_load_business_load_name_key 的约束也不存在,它已被删除,也没有出现在information_schema.key_column_usage 中。
有人知道这里发生了什么吗?
【问题讨论】:
-
我猜它看起来很接近同一个问题,但是那个问题仍然没有答案,我无法重新创建有问题的表,因为 mysql 认为已经有一个外键用那个名字。
标签: mysql foreign-keys