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

SIGSEGV in Item_cache_row::store on CASE NEW WHEN in trigger on single-column table

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Critical
    • Resolution: Unresolved
    • 13.2
    • 13.2
    • Triggers
    • None
    • Not for Release Notes

    Description

      CREATE TABLE t (a INT); 
      INSERT INTO t VALUES (1);
      DELIMITER $$
      CREATE TRIGGER tr BEFORE UPDATE ON t FOR EACH ROW BEGIN CASE NEW WHEN 1 THEN SET @x = 1; ELSE SET @x = 0; END CASE; END $$
      DELIMITER ;
      UPDATE t SET a = 2; 
      

      Leads to

      MDEV-34723 CS 13.2.0 0a83f874e3edbee2942f31792647b21101a555c6 (Optimized, Clang 18.1.3-11) Build 30/10/2026

      Core was generated by `/test/mtest/MDEV-34723/MD301026-mariadb-13.2.0-linux-x86_64-opt/bin/mariadbd --'.
      Program terminated with signal SIGSEGV, Segmentation fault.
      #0  0x00005f7fa9134467 in Item_cache_row::store (this=0x6e7e9006a560, item=0x6e7e90024330)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/item.cc:11941
      11941	    values[i]->store(item->element_index(i));
      [Current thread is 1 (LWP 1353025)]
      (gdb) bt
      #0  0x00005f7fa9134467 in Item_cache_row::store (this=0x6e7e9006a560, item=0x6e7e90024330)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/item.cc:11941
      #1  0x00005f7fa8de3b61 in sp_rcontext::set_case_expr (this=0x6e7e9006a440, thd=0x6e7e90000c70, case_expr_id=<optimized out>, case_expr_item_ptr=<optimized out>)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sp_rcontext.cc:830
      #2  0x00005f7fa90336a2 in sp_instr_set_case_expr::exec_core (this=0x6e7e900244a0, thd=0x6e7e90024330, nextp=0x767fd00a8394)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sp_instr.cc:3001
      #3  0x00005f7fa902e3da in sp_lex_keeper::reset_lex_and_exec_core (this=this@entry=0x6e7e900244d8, thd=thd@entry=0x6e7e90000c70, nextp=nextp@entry=0x767fd00a8394, open_tables=true, instr=instr@entry=0x6e7e900244a0, rerun_the_same_instr=<optimized out>)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sp_instr.cc:420
      #4  0x00005f7fa902ea06 in sp_lex_keeper::validate_lex_and_exec_core (this=0x6e7e900244d8, thd=0x6e7e90000c70, nextp=0x767fd00a8394, open_tables=<optimized out>, instr=0x6e7e900244a0)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sp_instr.cc:624
      #5  0x00005f7fa8dd75ca in sp_head::execute (this=this@entry=0x6e7e90022e20, thd=thd@entry=0x6e7e90000c70, merge_da_on_success=false)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sp_head.cc:1347
      #6  0x00005f7fa8dd8662 in sp_head::execute_trigger (this=0x6e7e90022e20, thd=0x6e7e90000c70, db_name=<optimized out>, table_name=<optimized out>, grant_info=<optimized out>)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sp_head.cc:1863
      #7  0x00005f7fa8f51dd6 in Table_triggers_list::process_triggers (this=0x6e7e900565c0, thd=0x6e7e90000c70, event=TRG_EVENT_UPDATE, time_type=<optimized out>, old_row_is_record1=<optimized out>, skip_row_indicator=0x767fd00a8c07, fields_in_update_stmt=0x6e7e90005d78)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_trigger.cc:2918
      #8  0x00005f7fa8e18f35 in fill_record_n_invoke_before_triggers (thd=thd@entry=0x6e7e90000c70, table=table@entry=0x6e7e90054ed0, fields=@0x6e7e90005d78: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x6e7e900186c0, last = 0x6e7e900186c0, elements = 1}, <No data fields>}, values=@0x6e7e90006220: {<base_list> = {<Sql_alloc> = {<No data fields>}, first = 0x6e7e900186d0, last = 0x6e7e900186d0, elements = 1}, <No data fields>}, ignore_errors=<optimized out>, event=event@entry=TRG_EVENT_UPDATE, skip_row_indicator=0x767fd00a8c07)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_base.cc:9774
      #9  0x00005f7fa8f64551 in Sql_cmd_update::update_single_table (this=this@entry=0x6e7e900186e0, thd=thd@entry=0x6e7e90000c70)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_update.cc:1010
      #10 0x00005f7fa8f694b2 in Sql_cmd_update::execute_inner (this=0x6e7e900186e0, thd=0x6e7e90000c70)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_update.cc:3320
      #11 0x00005f7fa8efeafb in Sql_cmd_dml::execute (this=0x6e7e900186e0, thd=0x6e7e90000c70)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_select.cc:35131
      #12 0x00005f7fa8e865e6 in mysql_execute_command (thd=thd@entry=0x6e7e90000c70, is_called_from_prepared_stmt=false)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_parse.cc:4493
      #13 0x00005f7fa8e81942 in mysql_parse (thd=thd@entry=0x6e7e90000c70, rawbuf=<optimized out>, length=<optimized out>, parser_state=parser_state@entry=0x767fd00a9580)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_parse.cc:8005
      #14 0x00005f7fa8e7fef8 in dispatch_command (command=command@entry=COM_QUERY, thd=thd@entry=0x6e7e90000c70, packet=packet@entry=0x6e7e90008ea1 "UPDATE t SET a = 2", packet_length=packet_length@entry=18, blocking=true)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_parse.cc:1903
      #15 0x00005f7fa8e81db1 in do_command (thd=thd@entry=0x6e7e90000c70, blocking=true)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_parse.cc:1437
      #16 0x00005f7fa8faea0d in do_handle_one_connection (connect=<optimized out>, connect@entry=0x5f7fe668bd90, put_in_cache=true)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_connect.cc:1514
      #17 0x00005f7fa8fae842 in handle_one_connection (arg=arg@entry=0x5f7fe668bd90)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/sql/sql_connect.cc:1426
      #18 0x00005f7fa935d123 in pfs_spawn_thread (arg=0x5f7fe66ac6d0)at /test/mtest/MDEV-34723/bb-MDEV-34723-rucha_opt/storage/perfschema/pfs.cc:2198
      #19 0x0000767fd2c9cb84 in start_thread (arg=<optimized out>)at ./nptl/pthread_create.c:447
      #20 0x0000767fd2d29ecc in clone3 ()at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:78
      

      Attachments

        Issue Links

          Activity

            People

              rucha174 Rucha Deodhar
              ramesh Ramesh Sivaraman
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:

                Time Tracking

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

                  Git Integration

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