Bug #61555 Triggers AFTER DELETE is NOT CALLED WHEN DELETE BY a ON DELETE CASCADE constrain
Submitted: 17 Jun 2011 20:54 Modified: 20 Jun 2011 12:45
Reporter: Rodrigo Galdi Email Updates:
Status: Unsupported Impact on me:
None 
Category:MySQL Server Severity:S1 (Critical)
Version:5.1.53-log OS:Linux
Assigned to: CPU Architecture:Any
Tags: foreign key delete cascade trigger

[17 Jun 2011 20:54] Rodrigo Galdi
Description:
I'm using a foreign key between table A->B.    A->child B->parent
When i delete a register from B, all children from A are deleted because a on delete cascade constraint i create ...... at this moment everything is fine. BUT, table A has a trigger on a AFTER DELETE condition.

The problem is that this trigger is not running when the constraint between A->B removes the A registers

I deleted the registers directly on table A, and the triggers run as expected....

How to repeat:
See description, o think it's easy to build an test database...

Suggested fix:
I think the correct shoulb be the trigger be called when a constraint ON DELETE CASCASE just like when i call delete from command
[17 Jun 2011 22:38] MySQL Verification Team
Thank you for the bug report. It's documented limitation:

http://dev.mysql.com/doc/refman/5.5/en/innodb-foreign-key-constraints.html

"CASCADE: Delete or update.....
 
Note

Currently, cascaded foreign key actions do not activate triggers."

See also Bug#11472 Triggers not executed following foreign key updates/deletes.
[20 Jun 2011 12:45] Rodrigo Galdi
Ok, it's a critical limitation.....and needless to say dificult to understand why this issue still happens.
Is this problem in pipeline to development? I don't think it would be dificult to solve. I'm sure that this would be a IMPORTANT fix.
Let's make MYSQL better.......i think this is basic feature os a BDMS.
[20 Aug 2011 11:34] Morg. What?
My poor Rodriguo, people have been waiting 5 years (at the very least) since that limitation/bug was "found".

And also,

This implies that MySQL InnoDB HAS NOT BEEN ACID COMPLIANT FOR THE LAST 5 YEARS.
[19 Sep 2013 17:50] Wayne Chan
Limitations like this one forces my team to continually invent new workarounds so that we can use Mysql like an ACID compliant DB. I cannot tell you how many times we have contemplated switching to Postgres because of unreasonable limitations like this. The only thing stopping is the fact that AWS RDS currently does not support Postgres. I appreciate the work that the Mysql has put into this wonderful DBMS, but why not just go a little bit further to make this a complete product? I wish I don't have to get the burning desire to switch to Postgres every few weeks.
[13 Nov 2014 8:48] Benjamin de Dardel
Bug seems to be still there ! 

$ mysql --version
mysql  Ver 14.14 Distrib 5.6.21, for debian-linux-gnu (x86_64) using  EditLine wrapper
[14 Dec 2014 16:24] Oleksii Orlov
The bug is still there, just faced it (5.6.21). Really, really disappointing...
[27 Apr 2015 15:36] Ariel Schiera
This bug still happens on Ubuntu 14.04:

MySQL version:
mysql  Ver 14.14 Distrib 5.5.41, for debian-linux-gnu (x86_64) using readline 6.3
 
Please support or a workaround would be really appreciated. Thanks.
[2 Mar 2016 7:59] Rakesh Kumar
This bug is there in version 5.6. Is there any plan to fix this?
[12 Jul 2016 17:51] Márcio Prando Teixeira Márcio
In version 5.7 same thing! FIX THIS!
[6 Sep 2016 9:06] Gemor Roj
I don't understand why does not fix this important problem?