I'm having a bit of a strange problem, I'm trying to add a foreign key to one table that references another, but it is failing for some reason. With my limited knowledge of MySQL, the only thing that could possibly be suspect is that there is a foreign key on a different table referencing the one I am trying to reference.
Here is a pict...
I'm trying to create a foreign key on a table in MySQL and I'm getting a strange error that there seems to be little info about in any of my searches.
I'm creating the key with this (emitted from mysql workbench 5.2):
ALTER TABLE `db`.`appointment`
ADD CONSTRAINT `FK_appointment_CancellationID`
FOREIGN KEY (`CancellationID` ) REFE...
Hello.
I do not require this error to be solved. I just need to understand what it means so I can approach it myself.
Cannot add or update a child row: a foreign key constraint fails
(`db`.`transaction`, CONSTRAINT `transaction_ibfk_2`
FOREIGN KEY (`product_id`) REFERENCES `product` (`id`))
INSERT INTO `transaction` ( `client_id...
I have a simple query
UPDATE `t_timecard_detail` SET `timeoff_request_id` = 'adad8e0d-c22b-41c3-a460-6cf982729299' WHERE `id` = 'cfc7a0a1-4e03-46a4-af89-069a0661cf55';
which gives this error
ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`demo1_timeapp`.`t_timecard_detail`, CONSTRAINT `timeoff...