Description:
Starting from version 9.7, the section "LATEST FOREIGN KEY ERROR" is not printed in the SHOW ENGINE INNODB STATUS even if a foreign key error happens.
How to repeat:
sveta@lemurr:~/src/percona/percona-toolkit$ mysql
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 22
Server version: 9.7.1 MySQL Community Server - GPL
Copyright (c) 2000, 2026, Oracle and/or its affiliates.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> create database test;
Query OK, 1 row affected (0.001 sec)
mysql> use test;
Database changed
mysql> DROP TABLE IF EXISTS child;
Query OK, 0 rows affected, 1 warning (0.001 sec)
mysql> DROP TABLE IF EXISTS parent;
Query OK, 0 rows affected, 1 warning (0.001 sec)
mysql>
mysql> CREATE TABLE parent (
-> id INT NOT NULL,
-> PRIMARY KEY (id)
-> ) ENGINE=INNODB;
Query OK, 0 rows affected (0.003 sec)
mysql>
mysql>
mysql> CREATE TABLE child (
-> id INT,
-> parent_id INT,
-> INDEX par_ind (parent_id),
-> FOREIGN KEY (parent_id) REFERENCES parent(id)
-> ) ENGINE=INNODB;
Query OK, 0 rows affected (0.004 sec)
mysql>
mysql> INSERT INTO parent VALUES (1), (2), (3);
Query OK, 3 rows affected (0.001 sec)
Records: 3 Duplicates: 0 Warnings: 0
mysql> INSERT INTO child VALUES (1, 9); -- Error!
ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`))
mysql> \P grep -A5 "LATEST FOREIGN KEY ERROR"
PAGER set to 'grep "LATEST FOREIGN KEY ERROR"'
mysql> show engine innodb status\G
1 row in set (0.000 sec)
Suggested fix:
Return 8.4 behavior:
...
mysql> INSERT INTO child VALUES (1, 9); -- Error!
ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`))
mysql> \P grep -A5 "LATEST FOREIGN KEY ERROR"
PAGER set to 'grep "LATEST FOREIGN KEY ERROR"'
mysql> show engine innodb status\G
LATEST FOREIGN KEY ERROR
------------------------
2026-07-14 19:34:25 128303396157120 Transaction:
TRANSACTION 1878, ACTIVE 0 sec inserting
mysql tables in use 1, locked 1
3 lock struct(s), heap size 1128, 1 row lock(s), undo log entries 1
1 row in set (0.001 sec)
Description: Starting from version 9.7, the section "LATEST FOREIGN KEY ERROR" is not printed in the SHOW ENGINE INNODB STATUS even if a foreign key error happens. How to repeat: sveta@lemurr:~/src/percona/percona-toolkit$ mysql mysql: [Warning] Using a password on the command line interface can be insecure. Welcome to the MySQL monitor. Commands end with ; or \g. Your MySQL connection id is 22 Server version: 9.7.1 MySQL Community Server - GPL Copyright (c) 2000, 2026, Oracle and/or its affiliates. Oracle is a registered trademark of Oracle Corporation and/or its affiliates. Other names may be trademarks of their respective owners. Type 'help;' or '\h' for help. Type '\c' to clear the current input statement. mysql> create database test; Query OK, 1 row affected (0.001 sec) mysql> use test; Database changed mysql> DROP TABLE IF EXISTS child; Query OK, 0 rows affected, 1 warning (0.001 sec) mysql> DROP TABLE IF EXISTS parent; Query OK, 0 rows affected, 1 warning (0.001 sec) mysql> mysql> CREATE TABLE parent ( -> id INT NOT NULL, -> PRIMARY KEY (id) -> ) ENGINE=INNODB; Query OK, 0 rows affected (0.003 sec) mysql> mysql> mysql> CREATE TABLE child ( -> id INT, -> parent_id INT, -> INDEX par_ind (parent_id), -> FOREIGN KEY (parent_id) REFERENCES parent(id) -> ) ENGINE=INNODB; Query OK, 0 rows affected (0.004 sec) mysql> mysql> INSERT INTO parent VALUES (1), (2), (3); Query OK, 3 rows affected (0.001 sec) Records: 3 Duplicates: 0 Warnings: 0 mysql> INSERT INTO child VALUES (1, 9); -- Error! ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`)) mysql> \P grep -A5 "LATEST FOREIGN KEY ERROR" PAGER set to 'grep "LATEST FOREIGN KEY ERROR"' mysql> show engine innodb status\G 1 row in set (0.000 sec) Suggested fix: Return 8.4 behavior: ... mysql> INSERT INTO child VALUES (1, 9); -- Error! ERROR 1452 (23000): Cannot add or update a child row: a foreign key constraint fails (`test`.`child`, CONSTRAINT `child_ibfk_1` FOREIGN KEY (`parent_id`) REFERENCES `parent` (`id`)) mysql> \P grep -A5 "LATEST FOREIGN KEY ERROR" PAGER set to 'grep "LATEST FOREIGN KEY ERROR"' mysql> show engine innodb status\G LATEST FOREIGN KEY ERROR ------------------------ 2026-07-14 19:34:25 128303396157120 Transaction: TRANSACTION 1878, ACTIVE 0 sec inserting mysql tables in use 1, locked 1 3 lock struct(s), heap size 1128, 1 row lock(s), undo log entries 1 1 row in set (0.001 sec)