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

Crash in Table_triggers_list::mark_fields_used on INSERT after trigger re-parse fails with unknown column

    XMLWordPrintable

Details

    • Bug
    • Status: In Review (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 13.2
    • 13.2
    • Triggers
    • Not for Release Notes
    • Q1/2027 Server Development

    Description

      CREATE TABLE t1 (a INT); 
      CREATE TABLE t2 (a INT); 
      CREATE TRIGGER tr BEFORE INSERT ON t1 FOR EACH ROW DO (SELECT a = NEW FROM t2);
      --ERROR ER_ILLEGAL_PARAMETER_DATA_TYPES2_FOR_OPERATION
      INSERT INTO t1 VALUES (1);
      ALTER TABLE t2 CHANGE a b INT;
      --ERROR ER_BAD_FIELD_ERROR
      INSERT INTO t1 VALUES (1);
      INSERT INTO t1 VALUES (1);
      

      Leads to

      MDEV-34723 CS 13.2.0 89cc41d5c46e1e322148d861e2b13527a7dd6306 (Debug, Clang 18.1.3-11) Build 22/10/2026

      Core was generated by `/test/mtest/MDEV-34723/MD221026-mariadb-13.2.0-linux-x86_64-dbg/bin/mariadbd --'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  Item_trigger_row::check_if_settable (this=0x8f8f8f8f8f8f8f8f)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/item.h:8058
       
      [Current thread is 1 (LWP 2757400)]
      (gdb) bt
      #0  Item_trigger_row::check_if_settable (this=0x8f8f8f8f8f8f8f8f)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/item.h:8058
      #1  0x000060d18687f868 in Table_triggers_list::mark_fields_used(trg_event_type)::$_1::operator()(Item_trigger_row*) const (this=0x763e9005aa80, trg_row=0x8f8f8f8f8f8f8f8f)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sql_trigger.cc:3082
      #2  0x000060d18687f03f in iterate_trigger_row_and_run_func<Table_triggers_list::mark_fields_used(trg_event_type)::$_1>(SQL_I_List<SQL_I_List<Item_trigger_row> >&, Table_triggers_list::mark_fields_used(trg_event_type)::$_1) (trg_table_row=@0x6e3d7c035388: {<Sql_alloc> = {<No data fields>}, elements = 1, first = 0x6e3d7c04b4e0, next = 0x6e3d7c0365b8}, fn={this = 0x6e3d7c03b970, fields_already_marked = @0x763e9005aacf})at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sql_trigger.cc:922
      #3  0x000060d18687eefa in Table_triggers_list::mark_fields_used (this=0x6e3d7c03b970, event=TRG_EVENT_INSERT)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sql_trigger.cc:3078
      #4  0x000060d1868c7d34 in TABLE::mark_columns_needed_for_insert (this=0x6e3d7c029d60)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/table.cc:8258
      #5  0x000060d1866b0c7d in mysql_insert (thd=0x6e3d7c000d60, table_list=0x6e3d7c01a5e0, fields=@0x6e3d7c0062d0: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x60d1885c3da0 <end_of_list>, last = 0x6e3d7c0062d0, elements = 0}, <No data fields>}, values_list=@0x6e3d7c006318: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x6e3d7c01b3c0, last = 0x6e3d7c01b3c0, elements = 1}, <No data fields>}, update_fields=@0x6e3d7c006300: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x60d1885c3da0 <end_of_list>, last = 0x6e3d7c006300, elements = 0}, <No data fields>}, update_values=@0x6e3d7c0062e8: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x60d1885c3da0 <end_of_list>, last = 0x6e3d7c0062e8, elements = 0}, <No data fields>}, duplic=DUP_ERROR, ignore=false, result=0x0)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sql_insert.cc:973
      #6  0x000060d186722f3b in mysql_execute_command (thd=0x6e3d7c000d60, is_called_from_prepared_stmt=false)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sql_parse.cc:4549
      #7  0x000060d186718a84 in mysql_parse (thd=0x6e3d7c000d60, rawbuf=0x6e3d7c01a4d0 "INSERT INTO t VALUES (5,6)", length=26, parser_state=0x763e9005ca80)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sql_parse.cc:8005
      #8  0x000060d186715e4d in dispatch_command (command=COM_QUERY, thd=0x6e3d7c000d60, packet=0x6e3d7c00b701 "INSERT INTO t VALUES (5,6)", packet_length=26, blocking=true)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sql_parse.cc:1903
      #9  0x000060d186719633 in do_command (thd=0x6e3d7c000d60, blocking=true)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sql_parse.cc:1437
      #10 0x000060d18691fd29 in do_handle_one_connection (connect=0x60d1a58443b0, put_in_cache=true)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sql_connect.cc:1514
      #11 0x000060d18691face in handle_one_connection (arg=0x60d1a592dbe0)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_dbg/sql/sql_connect.cc:1426
      #12 0x0000763e92c9cb84 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #13 0x0000763e92d29ecc in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Attachments

        Issue Links

          Activity

            People

              shulga Dmitry Shulga
              ramesh Ramesh Sivaraman
              Ramesh Sivaraman Ramesh Sivaraman
              Dmitry Shulga Dmitry Shulga
              Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

                  Estimated:
                  Original Estimate - 0d
                  0d
                  Remaining:
                  Time Spent - 0.5h Remaining Estimate - 1.5d
                  1.5d
                  Logged:
                  Time Spent - 0.5h Remaining Estimate - 1.5d
                  0.5h

                  Git Integration

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