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

Assertion `!is_set() || (m_status == DA_EOF_BULK && is_bulk_op())' failed on bulk INSERT ... RETURNING into a table with a trigger

    XMLWordPrintable

Details

    Description

      Bulk INSERT ... RETURNING (COM_STMT_BULK_EXECUTE) into a table with a BEFORE INSERT trigger which executes DML fails an assertion in debug builds.

      How to repeat

      CREATE TABLE t3 (id INT, val INT);
      CREATE TABLE t3log (v INT);
      CREATE TRIGGER t3_bi BEFORE INSERT ON t3 FOR EACH ROW
        INSERT INTO t3log VALUES (NEW.val);
      -- bulk, parameter sets (1,10), (2,20), (3,30):
      INSERT INTO t3 VALUES (?, ?) RETURNING id, val;

      Reproduced on 10.11 (10.11.19 debug) and 11.4 (11.4.13 debug, source revision 4813c2f0a8a79e4e4c000cc8c9447096fafe7033):

      sql_error.cc:386: void Diagnostics_area::set_eof_status(THD*): Assertion `!is_set() || (m_status == DA_EOF_BULK && is_bulk_op())' failed.
      sql/sql_class.h:6025(my_eof(THD*))
      sql/sql_class.cc:3256(select_send::send_eof())
      sql/sql_insert.cc:1448(mysql_insert(...))

      The statements of the trigger reset the diagnostics area, which in bulk mode gets DA_OK_BULK, and send_eof() then expects DA_EOF_BULK.

      Related: MDEV-24411 (triggers with bulk insert).

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              sanja Oleksandr Byelkin
              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.