[英]MySQL Error, what does it mean
I am trying to update two columns in a xref database. 我正在尝试更新外部参照数据库中的两列。 I am getting this error message:
我收到此错误消息:
Cannot add or update a child row: a foreign key constraint fails (`globaldetroit`.`org_cult_xref`, CONSTRAINT `org_cult_xref_ibfk_1` FOREIGN KEY (`org_id`) REFERENCES `organization` (`org_id`) ON DELETE CASCADE ON UPDATE CASCADE)
I want to be able to have a many-many relationship, and these errors seem to prevent me from having one. 我希望能够建立多对多关系,而这些错误似乎使我无法与他人建立关系。
EDIT: 编辑:
That is very odd! 真奇怪! There most certainly is a column org_id with the value of "6" (as an integer) in the table organization!
在表组织中,肯定有一个列org_id的值是“ 6”(作为整数)! I just checked!
我刚检查!
You are trying to set a value that has a foreign key constrant -- ie the key does not exist in the foreign table. 您正在尝试设置一个具有外键常量的值-即该键在外表中不存在。
So globaldetroit's
org_cult_xref
references an org_id
in organization
that does not exist. 因此,
globaldetroit's
org_cult_xref
引用了不存在的organization
中的org_id
。
you're putting in field globaldetroit
. 您
globaldetroit
投入工作。 org_cult_xref
value not existing in organization
. org_cult_xref
值在organization
不存在。 org_id
Many-many relationship is bad, don't go there. 多对多关系不好,不要去那里。
Your error seems to be caused because the row you insert in org_cult_xref has a column org_id and the value you insert there cannot be found in the organization table. 您的错误似乎是由于您在org_cult_xref中插入的行具有org_id列而在组织表中找不到您在其中插入的值所致。
您在要插入/更新到的表上定义了一个外键,这基本上说org_id
的值应该存在于organization
表中,事实并非如此。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.