Uploaded image for project: 'MariaDB Server'
  1. MariaDB Server
  2. MDEV-40083

Compound triggers for startup/shutdown are stored without END, which leads to silent non-firing after restart

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Blocker
    • Resolution: Unresolved
    • N/A
    • 13.1
    • Triggers
    • None
    • Q3/2026 Server Maintenance

    Description

      bb-13.0-MDEV-30645 a51f81628b0cc9b74d0b

      CREATE TABLE t (a INT);
      delimiter |;
      CREATE TRIGGER c1 AFTER STARTUP  BEGIN INSERT INTO test.t VALUES (1); END|
      CREATE TRIGGER c2 BEFORE SHUTDOWN BEGIN INSERT INTO test.t VALUES (2); INSERT INTO test.t VALUES (3); END|
      delimiter ;|
       
      SELECT name, body FROM mysql.event WHERE name IN ('c1','c2') ORDER BY name;
      SHOW CREATE TRIGGER c1;
      SHOW CREATE TRIGGER c2;
       
      --source include/restart_mysqld.inc
       
      SELECT * from t;
       
      --source include/restart_mysqld.inc
       
      SELECT * from t;
       
      DROP TRIGGER c1;
      DROP TRIGGER c2;
      DROP TABLE t;
      

      CREATE TABLE t (a INT);
      CREATE TRIGGER c1 AFTER STARTUP  BEGIN INSERT INTO test.t VALUES (1); END|
      CREATE TRIGGER c2 BEFORE SHUTDOWN BEGIN INSERT INTO test.t VALUES (2); INSERT INTO test.t VALUES (3); END|
      SELECT name, body FROM mysql.event WHERE name IN ('c1','c2') ORDER BY name;
      name	body
      c1	BEGIN INSERT INTO test.t VALUES (1);
      c2	BEGIN INSERT INTO test.t VALUES (2); INSERT INTO test.t VALUES (3);
      SHOW CREATE TRIGGER c1;
      Trigger	sql_mode	SQL Original Statement	character_set_client	collation_connection	Database Collation	Created
      c1	STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION	CREATE DEFINER=`root`@`localhost` TRIGGER c1 AFTER STARTUP BEGIN INSERT INTO test.t VALUES (1);	latin1	latin1_swedish_ci	utf8mb4_uca1400_ai_ci	2026-06-17 09:54:57.00
      SHOW CREATE TRIGGER c2;
      Trigger	sql_mode	SQL Original Statement	character_set_client	collation_connection	Database Collation	Created
      c2	STRICT_TRANS_TABLES,ERROR_FOR_DIVISION_BY_ZERO,NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION	CREATE DEFINER=`root`@`localhost` TRIGGER c2 BEFORE SHUTDOWN BEGIN INSERT INTO test.t VALUES (2); INSERT INTO test.t VALUES (3);	latin1	latin1_swedish_ci	utf8mb4_uca1400_ai_ci	2026-06-17 09:54:57.00
      # restart
      SELECT * from t;
      a
      2
      3
      # restart
      SELECT * from t;
      a
      2
      3
      DROP TRIGGER c1;
      DROP TRIGGER c2;
      DROP TABLE t;
      main.1_my                                [ fail ]  Found warnings/errors in server log file!
              Test ended at 2026-06-17 09:55:37
      line
      Warning: Internal memory accounting error of 112656 bytes
      ==1675245==ERROR: LeakSanitizer: detected memory leaks
      SUMMARY: AddressSanitizer: 112656 byte(s) leaked in 44 allocation(s).
      
      

      Attachments

        Issue Links

          Activity

            People

              shulga Dmitry Shulga
              alice Alice Sherepa
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Git Integration

                  Error rendering 'com.xiplink.jira.git.jira_git_plugin:git-issue-webpanel'. Please contact your Jira administrators.