I find the following problem that makes me curious, since I could not find an answer looking:
I have some tables that resemble the following scheme
Suppose that table A has records with id 1 and I want to execute the next sql
DELETE FROM A WHERE id_A=1;
But the id_A=1
exists in tables B, C and D, then you would receive this error:
Error Code: 1451. Can not delete or update a parent row: a foreign key constraint fails (test.A, CONSTRAINT fk_A_B FOREIGN KEY (id_A) REFERENCES A (id_A) ON DELETE NO ACTION ON UPDATE NO ACTION)
Which makes sense since the FK causes me a referential integrity error. Now my question is this Is there a way to know if the FK is going to prevent me from deleting records before the error comes out? And if there is, is there a way to know how many and which tables would cause the error? Since the mysql only warns me of one and there could be several.