Why the Infamous 20‑Year‑Old MySQL Bug #11472 Was Finally Fixed
After two decades of causing trigger failures during cascaded foreign‑key updates, MySQL Bug #11472 was finally resolved in March 2026, ending a long‑running saga that sparked countless community jokes, developer debates, and detailed reproduction steps.
Bug #11472 description
When rows are updated or deleted indirectly via a foreign‑key cascade, triggers on the affected table are not executed. The issue was reported on 2005‑06‑21 by Omer Barnir.
When due to a foreign‑key definition rows are indirectly updated/deleted, the trigger on that table does not execute as expected.
Minimal reproducer
USE test;
DROP TABLE IF EXISTS t1,t2;
CREATE TABLE t1 (id INT NOT NULL, col1 CHAR(50), PRIMARY KEY (id)) ENGINE=INNODB;
CREATE TABLE t2 (
id INT PRIMARY KEY,
f_id INT,
INDEX par_ind (f_id),
col1 CHAR(50),
FOREIGN KEY (f_id) REFERENCES t1(id) ON DELETE SET NULL
) ENGINE=INNODB;
CREATE TRIGGER tr_t2 AFTER UPDATE ON t2 FOR EACH ROW SET @counter=@counter+1;
INSERT INTO t1 VALUES (1,'Department A'),(2,'Department B'),(3,'Department C');
INSERT INTO t2 VALUES (1,2,'Emp 1'),(2,2,'Emp 2'),(3,2,'Emp 3'),(4,2,'Emp 4'),(5,2,'Emp 5');
SET @counter=0;
SELECT @counter; -- 0
DELETE FROM t1 WHERE id=2; -- cascades, sets f_id to NULL
SELECT @counter; -- still 0 (trigger not fired)
UPDATE t2 SET col1='Emp 5a' WHERE id=5;
SELECT @counter; -- 1 (trigger fires on direct update)Why the bug persisted
Heikki Tuuri replied on the day of the report, promising a future fix and downgrading the severity to P3. In 2007 he reiterated that InnoDB’s foreign‑key implementation would eventually address the issue. Konstantin Osipov (2009) confirmed that MySQL 5.1 would not contain a fix. Ståle Deraas (2013) explained that fixing the bug required substantial engineering effort, not a simple patch.
Impact
The bug violates ACID guarantees because a cascade that modifies rows does not fire AFTER triggers, leading to hidden data‑drift in statement‑based replication. TiDB engineer Daniël van Eeden noted that when the bug is fixed, triggers that previously executed only on the replica could start executing on the primary, causing inconsistency.
Fix in MySQL 2026
In March 2026 the work item WL#17024 was closed. The trigger‑execution logic was corrected so that AFTER triggers fire for rows modified by cascaded foreign‑key actions. Release notes include an optional configuration switch to retain the legacy behavior for applications that depended on the bug, but the corrected behavior is recommended.
Post‑fix implications
InnoDB triggers now fire consistently for both direct and indirect updates.
Statement‑based replication no longer suffers from silent data drift caused by missing trigger execution.
Legacy applications can enable the compatibility switch if required.
Signed-in readers can open the original source through BestHub's protected redirect.
This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactand we will review it promptly.
dbaplus Community
Enterprise-level professional community for Database, BigData, and AIOps. Daily original articles, weekly online tech talks, monthly offline salons, and quarterly XCOPS&DAMS conferences—delivered by industry experts.
How this landed with the community
Was this worth your time?
0 Comments
Thoughtful readers leave field notes, pushback, and hard-won operational detail here.
