Description:
During the upgrade process from any MySQL server > 8.0 (5.7 upgrade have separate code path which is unaffected by this bug), stored events that use ANSI quotes (double quotes ") fail to parse, resulting in the error `[MY-013235] [Server] Error in parsing Event` and server shutdown. This issue occurs when sql_mode includes ANSI_QUOTES at the event level. The upgrade process appears to ignore the preserved sql_mode of the event during the parsing check, causing valid ANSI SQL syntax to be flagged as invalid.
How to repeat:
1. Start MySQL server of any version greater that 8.0, e.g. 8.0.44
2. Run the following:
mysql> SET GLOBAL sql_mode = 'ANSI';
Query OK, 0 rows affected (0.00 sec)
mysql> CREATE DATABASE testdb;
Query OK, 1 row affected (0.00 sec)
mysql> USE testdb;
Database changed
mysql> CREATE TABLE IF NOT EXISTS "test_table" (
"id" INT AUTO_INCREMENT PRIMARY KEY,
"name" VARCHAR(100) NOT NULL,
"created_at" TIMESTAMP DEFAULT CURRENT_TIMESTAMP
) ENGINE=InnoDB;
Query OK, 0 rows affected (0.0159 sec)
mysql> INSERT INTO "test_table" ("name") VALUES ('Test Record 1'), ('Test Record 2');
Query OK, 2 rows affected (0.01 sec)
mysql> DELIMITER $$
mysql> CREATE EVENT IF NOT EXISTS "test_event_ansi_quotes"
ON SCHEDULE EVERY 1 MINUTE
DO
BEGIN
INSERT INTO "test_table" ("name")
VALUES (CONCAT('Event triggered at ', NOW()));
END$$
Query OK, 0 rows affected (0.01 sec)
mysql> DELIMITER ;
mysql> SHOW CREATE EVENT "test_event_ansi_quotes";
+------------------------+--------------------------------------------------------------------------------+-----------+--------------------
-------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------
--------------------------+----------------------+----------------------+--------------------+
| Event | sql_mode | time_zone | Create Event
| character_set_client | collation_connection | Database Collation |
+------------------------+--------------------------------------------------------------------------------+-----------+--------------------
-------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------
--------------------------+----------------------+----------------------+--------------------+
| test_event_ansi_quotes | REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ONLY_FULL_GROUP_BY,ANSI | SYSTEM | CREATE DEFINER="roo
t"@"%" EVENT "test_event_ansi_quotes" ON SCHEDULE EVERY 1 MINUTE STARTS '2026-01-13 14:22:24' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN
-- Use double quotes for table and column names (valid in ANSI mode)
INSERT INTO "test_table" ("name")
VALUES (CONCAT('Event triggered at ', NOW()));
END | utf8mb4 | utf8mb4_0900_ai_ci | utf8mb4_0900_ai_ci |
+------------------------+--------------------------------------------------------------------------------+-----------+--------------------
-------------------------------------------------------------------------------------------------------------------------------------------
-------------------------------------------------------------------------------------------------------------------------------------------
--------------------------+----------------------+----------------------+--------------------+
1 row in set (0.0009 sec)
3. Upgrade MySQL to any allowed version, e.g. 8.4.7
4. Observe error logs
[mysql-8.4.7] | 2026-01-13T14:23:58.060139Z 1 [ERROR] [MY-013235] [Server] Error in parsing Event 'testdb'.'test_event_ansi_quotes' during upgrade. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"test_table" ("name") VALUES (CONCAT('Event triggered at ', NOW())); END' at line 3
[mysql-8.4.7] | 2026-01-13T14:23:58.061794Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed.
[mysql-8.4.7] | 2026-01-13T14:23:58.061816Z 0 [ERROR] [MY-010119] [Server] Aborting
[mysql-8.4.7] | 2026-01-13T14:23:59.534809Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.4.7) MySQL Community Server - GPL.
[mysql-8.4.7] | 2026-01-13T14:23:59.534830Z 0 [System] [MY-015016] [Server] MySQL Server - end.
5. Which is a bug
I've created github repository with docker-compose file and bash scripts to reproduce this issue automatically: https://github.com/VitaliVinahradski/mysql-event-upgrade-bug-reproduction
Suggested fix:
Existing workaround: drop event before upgrade and recreate using standard (backticks) MySQL syntax.
Suggested fix is to modify check_events code in sql/dd/impl/upgrade/server.cc to respect Event's sql_mode
Description: During the upgrade process from any MySQL server > 8.0 (5.7 upgrade have separate code path which is unaffected by this bug), stored events that use ANSI quotes (double quotes ") fail to parse, resulting in the error `[MY-013235] [Server] Error in parsing Event` and server shutdown. This issue occurs when sql_mode includes ANSI_QUOTES at the event level. The upgrade process appears to ignore the preserved sql_mode of the event during the parsing check, causing valid ANSI SQL syntax to be flagged as invalid. How to repeat: 1. Start MySQL server of any version greater that 8.0, e.g. 8.0.44 2. Run the following: mysql> SET GLOBAL sql_mode = 'ANSI'; Query OK, 0 rows affected (0.00 sec) mysql> CREATE DATABASE testdb; Query OK, 1 row affected (0.00 sec) mysql> USE testdb; Database changed mysql> CREATE TABLE IF NOT EXISTS "test_table" ( "id" INT AUTO_INCREMENT PRIMARY KEY, "name" VARCHAR(100) NOT NULL, "created_at" TIMESTAMP DEFAULT CURRENT_TIMESTAMP ) ENGINE=InnoDB; Query OK, 0 rows affected (0.0159 sec) mysql> INSERT INTO "test_table" ("name") VALUES ('Test Record 1'), ('Test Record 2'); Query OK, 2 rows affected (0.01 sec) mysql> DELIMITER $$ mysql> CREATE EVENT IF NOT EXISTS "test_event_ansi_quotes" ON SCHEDULE EVERY 1 MINUTE DO BEGIN INSERT INTO "test_table" ("name") VALUES (CONCAT('Event triggered at ', NOW())); END$$ Query OK, 0 rows affected (0.01 sec) mysql> DELIMITER ; mysql> SHOW CREATE EVENT "test_event_ansi_quotes"; +------------------------+--------------------------------------------------------------------------------+-----------+-------------------- ------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------- --------------------------+----------------------+----------------------+--------------------+ | Event | sql_mode | time_zone | Create Event | character_set_client | collation_connection | Database Collation | +------------------------+--------------------------------------------------------------------------------+-----------+-------------------- ------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------- --------------------------+----------------------+----------------------+--------------------+ | test_event_ansi_quotes | REAL_AS_FLOAT,PIPES_AS_CONCAT,ANSI_QUOTES,IGNORE_SPACE,ONLY_FULL_GROUP_BY,ANSI | SYSTEM | CREATE DEFINER="roo t"@"%" EVENT "test_event_ansi_quotes" ON SCHEDULE EVERY 1 MINUTE STARTS '2026-01-13 14:22:24' ON COMPLETION NOT PRESERVE ENABLE DO BEGIN -- Use double quotes for table and column names (valid in ANSI mode) INSERT INTO "test_table" ("name") VALUES (CONCAT('Event triggered at ', NOW())); END | utf8mb4 | utf8mb4_0900_ai_ci | utf8mb4_0900_ai_ci | +------------------------+--------------------------------------------------------------------------------+-----------+-------------------- ------------------------------------------------------------------------------------------------------------------------------------------- ------------------------------------------------------------------------------------------------------------------------------------------- --------------------------+----------------------+----------------------+--------------------+ 1 row in set (0.0009 sec) 3. Upgrade MySQL to any allowed version, e.g. 8.4.7 4. Observe error logs [mysql-8.4.7] | 2026-01-13T14:23:58.060139Z 1 [ERROR] [MY-013235] [Server] Error in parsing Event 'testdb'.'test_event_ansi_quotes' during upgrade. You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near '"test_table" ("name") VALUES (CONCAT('Event triggered at ', NOW())); END' at line 3 [mysql-8.4.7] | 2026-01-13T14:23:58.061794Z 0 [ERROR] [MY-010020] [Server] Data Dictionary initialization failed. [mysql-8.4.7] | 2026-01-13T14:23:58.061816Z 0 [ERROR] [MY-010119] [Server] Aborting [mysql-8.4.7] | 2026-01-13T14:23:59.534809Z 0 [System] [MY-010910] [Server] /usr/sbin/mysqld: Shutdown complete (mysqld 8.4.7) MySQL Community Server - GPL. [mysql-8.4.7] | 2026-01-13T14:23:59.534830Z 0 [System] [MY-015016] [Server] MySQL Server - end. 5. Which is a bug I've created github repository with docker-compose file and bash scripts to reproduce this issue automatically: https://github.com/VitaliVinahradski/mysql-event-upgrade-bug-reproduction Suggested fix: Existing workaround: drop event before upgrade and recreate using standard (backticks) MySQL syntax. Suggested fix is to modify check_events code in sql/dd/impl/upgrade/server.cc to respect Event's sql_mode