MySQL trigger is not called by constraints
constraints, mysql, triggers
Solution
Triggers aren't fired if the delete is caused by a foreign key.
From the manual
Triggers currently are not activated by foreign key actions.
Problem
I have two (InnoDB) tables with triggers for UPDATE, INSERT and DELETE. They work fine if I work directly on the tables. Further I have a foreign key constraint when I delete a row in tableA all rows in tableB referenced by tableA.id get also deleted. That also works but the problem is: A DELETE on tableA triggers the DELETE-trigger for tableA. Then the constraint deletes rows at tableB but no DELETE-triggers for tableB get called. Why? Do constraints do not trigger triggers? Thanks. (Triggers are AFTER DELETE. Tried also with BEFORE DELETE without success.)