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

Assertion `! thd->in_sub_stmt' failed in trans_commit_stmt upon creating sequence in stored function

    XMLWordPrintable

Details

    Description

      --delimiter $
      CREATE FUNCTION f() RETURNS INT
      BEGIN
        CREATE TEMPORARY SEQUENCE s;
        RETURN 0;
      END $
      --delimiter ;
       
      --error ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG
      SELECT f();
       
      # Cleanup
      DROP FUNCTION f;
      

      10.4 f5dceafd

      mysqld: /data/src/10.4/sql/transaction.cc:431: bool trans_commit_stmt(THD*): Assertion `! thd->in_sub_stmt' failed.
      230619 16:01:35 [ERROR] mysqld got signal 6 ;
       
      #9  0x00007f556c453df2 in __GI___assert_fail (assertion=0x55752ab266c0 "! thd->in_sub_stmt", file=0x55752ab25c60 "/data/src/10.4/sql/transaction.cc", line=431, function=0x55752ab26700 "bool trans_commit_stmt(THD*)") at ./assert/assert.c:101
      #10 0x0000557528dac11b in trans_commit_stmt (thd=0x62b00005b208) at /data/src/10.4/sql/transaction.cc:431
      #11 0x0000557528f41bef in sequence_insert (thd=0x62b00005b208, lex=0x625000104128, org_table_list=0x6250001028c0) at /data/src/10.4/sql/sql_sequence.cc:374
      #12 0x0000557528bdcbeb in mysql_create_table_no_lock (thd=0x62b00005b208, db=0x6250001028d8, table_name=0x6250001028e8, create_info=0x7f5564763ff0, alter_info=0x7f5564763ef0, is_trans=0x7f5564763cd0, create_table_mode=0, table_list=0x6250001028c0) at /data/src/10.4/sql/sql_table.cc:5280
      #13 0x0000557528bdd8f1 in mysql_create_table (thd=0x62b00005b208, create_table=0x6250001028c0, create_info=0x7f5564763ff0, alter_info=0x7f5564763ef0) at /data/src/10.4/sql/sql_table.cc:5416
      #14 0x0000557528c0bffd in Sql_cmd_create_table_like::execute (this=0x625000102890, thd=0x62b00005b208) at /data/src/10.4/sql/sql_table.cc:11823
      #15 0x0000557528991c61 in mysql_execute_command (thd=0x62b00005b208) at /data/src/10.4/sql/sql_parse.cc:6216
      #16 0x00005575287425bc in sp_instr_stmt::exec_core (this=0x625000103848, thd=0x62b00005b208, nextp=0x7f5564765e90) at /data/src/10.4/sql/sp_head.cc:3694
      #17 0x0000557528740cdd in sp_lex_keeper::reset_lex_and_exec_core (this=0x625000103890, thd=0x62b00005b208, nextp=0x7f5564765e90, open_tables=false, instr=0x625000103848) at /data/src/10.4/sql/sp_head.cc:3424
      #18 0x0000557528741d53 in sp_instr_stmt::execute (this=0x625000103848, thd=0x62b00005b208, nextp=0x7f5564765e90) at /data/src/10.4/sql/sp_head.cc:3600
      #19 0x0000557528733379 in sp_head::execute (this=0x625000101928, thd=0x62b00005b208, merge_da_on_success=true) at /data/src/10.4/sql/sp_head.cc:1365
      #20 0x000055752873757a in sp_head::execute_function (this=0x625000101928, thd=0x62b00005b208, argp=0x0, argcount=0, return_value_fld=0x62b000065338, func_ctx=0x62b000062ac0, call_arena=0x62b000063ea8) at /data/src/10.4/sql/sp_head.cc:2088
      #21 0x0000557529180bbd in Item_sp::execute_impl (this=0x62b000062a60, thd=0x62b00005b208, args=0x0, arg_count=0) at /data/src/10.4/sql/item.cc:2846
      #22 0x0000557529180157 in Item_sp::execute (this=0x62b000062a60, thd=0x62b00005b208, null_value=0x62b000062a16, args=0x0, arg_count=0) at /data/src/10.4/sql/item.cc:2761
      #23 0x00005575292b45db in Item_func_sp::execute (this=0x62b0000629a0) at /data/src/10.4/sql/item_func.cc:6510
      #24 0x00005575292c433a in Item_func_sp::val_int (this=0x62b0000629a0) at /data/src/10.4/sql/item_func.h:3292
      #25 0x0000557528ef47d2 in Type_handler::Item_send_long (this=0x55752bb3a000 <type_handler_long>, item=0x62b0000629a0, protocol=0x62b00005b808, buf=0x7f5564766d70) at /data/src/10.4/sql/sql_type.cc:7106
      #26 0x0000557528f0dd02 in Type_handler_long::Item_send (this=0x55752bb3a000 <type_handler_long>, item=0x62b0000629a0, protocol=0x62b00005b808, buf=0x7f5564766d70) at /data/src/10.4/sql/sql_type.h:5191
      #27 0x00005575286cb84c in Item::send (this=0x62b0000629a0, protocol=0x62b00005b808, buffer=0x7f5564766d70) at /data/src/10.4/sql/item.h:1044
      #28 0x00005575286bd8e9 in Protocol::send_result_set_row (this=0x62b00005b808, row_items=0x62b000062410) at /data/src/10.4/sql/protocol.cc:1038
      #29 0x00005575288683bb in select_send::send_data (this=0x62b000064b98, items=...) at /data/src/10.4/sql/sql_class.cc:3139
      #30 0x0000557528a50bf0 in JOIN::exec_inner (this=0x62b000064bc8) at /data/src/10.4/sql/sql_select.cc:4473
      #31 0x0000557528a4f7c4 in JOIN::exec (this=0x62b000064bc8) at /data/src/10.4/sql/sql_select.cc:4387
      #32 0x0000557528a53856 in mysql_select (thd=0x62b00005b208, tables=0x0, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147748608, result=0x62b000064b98, unit=0x62b00005f140, select_lex=0x62b0000622b0) at /data/src/10.4/sql/sql_select.cc:4826
      #33 0x0000557528a24461 in handle_select (thd=0x62b00005b208, lex=0x62b00005f080, result=0x62b000064b98, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:442
      #34 0x000055752899428b in execute_sqlcom_select (thd=0x62b00005b208, all_tables=0x0) at /data/src/10.4/sql/sql_parse.cc:6473
      #35 0x00005575289817a0 in mysql_execute_command (thd=0x62b00005b208) at /data/src/10.4/sql/sql_parse.cc:3976
      #36 0x000055752899d463 in mysql_parse (thd=0x62b00005b208, rawbuf=0x62b000062228 "SELECT f()", length=10, parser_state=0x7f5564769860, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:8008
      #37 0x00005575289737a6 in dispatch_command (command=COM_QUERY, thd=0x62b00005b208, packet=0x629000230209 "", packet_length=10, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1857
      #38 0x0000557528970315 in do_command (thd=0x62b00005b208) at /data/src/10.4/sql/sql_parse.cc:1378
      #39 0x0000557528d6f0ba in do_handle_one_connection (connect=0x6080000009a8) at /data/src/10.4/sql/sql_connect.cc:1420
      #40 0x0000557528d6e9d1 in handle_one_connection (arg=0x6080000009a8) at /data/src/10.4/sql/sql_connect.cc:1324
      #41 0x00005575299dbaee in pfs_spawn_thread (arg=0x615000003508) at /data/src/10.4/storage/perfschema/pfs.cc:1869
      #42 0x00007f556c4a7fd4 in start_thread (arg=<optimized out>) at ./nptl/pthread_create.c:442
      #43 0x00007f556c5285bc in clone3 () at ../sysdeps/unix/sysv/linux/x86_64/clone3.S:81
      

      Reproducible on all of 10.4-11.1 debug builds.
      Non-debug returns ER_COMMIT_NOT_ALLOWED_IN_SF_OR_TRG as it probably should

      1422: Explicit or implicit commit is not allowed in stored function or trigger
      

      Attachments

        Activity

          People

            sanja Oleksandr Byelkin
            elenst Elena Stepanova
            Votes:
            0 Vote for this issue
            Watchers:
            2 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.