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

Assertion `result_field' failed in Item_result_field::get_tmp_field_src, Assertion `((Item_result_field*)item)->result_field' in create_tmp_field

    XMLWordPrintable

Details

    • Bug
    • Status: Open (View Workflow)
    • Major
    • Resolution: Unresolved
    • 10.2(EOL), 10.3(EOL), 10.4(EOL), 10.5
    • 10.5
    • Server
    • None

    Description

      CREATE TABLE t1 (a INT);
      INSERT INTO t1 VALUES (1),(2);
       
      --connect (con1,localhost,root,,)
      CREATE TABLE t2 AS SELECT a, GROUP_CONCAT(LENGTH(a), 1/ROW_COUNT()) AS f FROM t1 GROUP BY a WITH ROLLUP;
       
      # Cleanup
      --disconnect con1
      --connection default
      DROP TABLE t1, t2;
      

      Same effect can be achieved within a single connection, if there is no INSERT, or ROW_COUNT value is otherwise reset to 0.

      10.2 95bb3cb8

      mysqld: /data/src/10.2/sql/sql_select.cc:16576: Field* create_tmp_field(THD*, TABLE*, Item*, Item::Type, Item***, Field**, Field**, bool, bool, bool, bool): Assertion `((Item_result_field*)item)->result_field' failed.
      201019 19:17:31 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007fcbb763cf36 in __GI___assert_fail (assertion=0x5650dcd35fd8 "((Item_result_field*)item)->result_field", file=0x5650dcd33eb0 "/data/src/10.2/sql/sql_select.cc", line=16576, function=0x5650dcd35f50 "Field* create_tmp_field(THD*, TABLE*, Item*, Item::Type, Item***, Field**, Field**, bool, bool, bool, bool)") at assert.c:101
      #8  0x00005650dc2d66a4 in create_tmp_field (thd=0x7fcb60000d90, table=0x7fcb60023c28, item=0x7fcb60011d38, type=Item::FUNC_ITEM, copy_func=0x7fcbb1a57de8, from_field=0x7fcb60024ce0, default_field=0x7fcb60024cc0, group=false, modify_item=false, table_cant_handle_bit_fields=false, make_copy_field=true) at /data/src/10.2/sql/sql_select.cc:16576
      #9  0x00005650dc2d7b24 in create_tmp_table (thd=0x7fcb60000d90, param=0x7fcb60016440, fields=..., group=0x0, distinct=false, save_sum_fields=true, select_options=2416184064, rows_limit=18446744073709551615, table_alias=0x5650dce17d8e "", do_not_open=false, keep_row_order=false) at /data/src/10.2/sql/sql_select.cc:16970
      #10 0x00005650dc5d58d8 in Item_func_group_concat::setup (this=0x7fcb60015f30, thd=0x7fcb60000d90) at /data/src/10.2/sql/item_sum.cc:3748
      #11 0x00005650dc5d653d in Aggregator_simple::setup (this=0x7fcb60016378, thd=0x7fcb60000d90) at /data/src/10.2/sql/item_sum.h:706
      #12 0x00005650dc2f4d14 in Item_sum::aggregator_setup (this=0x7fcb60015f30, thd=0x7fcb60000d90) at /data/src/10.2/sql/item_sum.h:541
      #13 0x00005650dc2e90af in setup_sum_funcs (thd=0x7fcb60000d90, func_ptr=0x7fcb60014550) at /data/src/10.2/sql/sql_select.cc:23798
      #14 0x00005650dc2b2f49 in JOIN::make_aggr_tables_info (this=0x7fcb60012fb0) at /data/src/10.2/sql/sql_select.cc:2833
      #15 0x00005650dc2b0ab2 in JOIN::optimize_inner (this=0x7fcb60012fb0) at /data/src/10.2/sql/sql_select.cc:2246
      #16 0x00005650dc2acbd0 in JOIN::optimize (this=0x7fcb60012fb0) at /data/src/10.2/sql/sql_select.cc:1114
      #17 0x00005650dc2b610e in mysql_select (thd=0x7fcb60000d90, tables=0x7fcb60012550, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x0, group=0x7fcb60012c88, having=0x0, proc_param=0x0, select_options=2416184064, result=0x7fcb60012ec0, unit=0x7fcb60004988, select_lex=0x7fcb600050c8) at /data/src/10.2/sql/sql_select.cc:3819
      #18 0x00005650dc2aa344 in handle_select (thd=0x7fcb60000d90, lex=0x7fcb600048c8, result=0x7fcb60012ec0, setup_tables_done_option=0) at /data/src/10.2/sql/sql_select.cc:361
      #19 0x00005650dc34afa5 in Sql_cmd_create_table::execute (this=0x7fcb600114a8, thd=0x7fcb60000d90) at /data/src/10.2/sql/sql_table.cc:10944
      #20 0x00005650dc273c5b in mysql_execute_command (thd=0x7fcb60000d90) at /data/src/10.2/sql/sql_parse.cc:5967
      #21 0x00005650dc278c71 in mysql_parse (thd=0x7fcb60000d90, rawbuf=0x7fcb60011338 "CREATE TABLE t2 AS SELECT a, GROUP_CONCAT(LENGTH(a), 1/ROW_COUNT()) AS f FROM t1 GROUP BY a WITH ROLLUP", length=103, parser_state=0x7fcbb1a595f0, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:7736
      #22 0x00005650dc266f80 in dispatch_command (command=COM_QUERY, thd=0x7fcb60000d90, packet=0x7fcb60008b51 "CREATE TABLE t2 AS SELECT a, GROUP_CONCAT(LENGTH(a), 1/ROW_COUNT()) AS f FROM t1 GROUP BY a WITH ROLLUP", packet_length=103, is_com_multi=false, is_next_command=false) at /data/src/10.2/sql/sql_parse.cc:1826
      #23 0x00005650dc265a7b in do_command (thd=0x7fcb60000d90) at /data/src/10.2/sql/sql_parse.cc:1380
      #24 0x00005650dc3bf6bf in do_handle_one_connection (connect=0x5650df872a30) at /data/src/10.2/sql/sql_connect.cc:1336
      #25 0x00005650dc3bf424 in handle_one_connection (arg=0x5650df872a30) at /data/src/10.2/sql/sql_connect.cc:1241
      #26 0x00005650dcbe3622 in pfs_spawn_thread (arg=0x5650df8b2ef0) at /data/src/10.2/storage/perfschema/pfs.cc:1869
      #27 0x00007fcbb7b4e609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #28 0x00007fcbb7728293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Same on 10.3.
      On 10.4 and 10.5 the assertion is different:

      10.4 a6f95648

      mysqld: /data/src/10.4/sql/sql_select.cc:17942: void Item_result_field::get_tmp_field_src(Tmp_field_src*, const Tmp_field_param*): Assertion `result_field' failed.
      201019 19:19:30 [ERROR] mysqld got signal 6 ;
       
      #7  0x00007f29e9741f36 in __GI___assert_fail (assertion=0x56515d10e145 "result_field", file=0x56515d10b3f8 "/data/src/10.4/sql/sql_select.cc", line=17942, function=0x56515d10e158 "void Item_result_field::get_tmp_field_src(Tmp_field_src*, const Tmp_field_param*)") at assert.c:101
      #8  0x000056515c3be5ca in Item_result_field::get_tmp_field_src (this=0x7f29cc012fb8, src=0x7f29df699c70, param=0x7f29df699c64) at /data/src/10.4/sql/sql_select.cc:17942
      #9  0x000056515c3be75d in Item_result_field::create_tmp_field_ex (this=0x7f29cc012fb8, table=0x7f29cc04aaa8, src=0x7f29df699c70, param=0x7f29df699c64) at /data/src/10.4/sql/sql_select.cc:17964
      #10 0x000056515c3bea97 in create_tmp_field (table=0x7f29cc04aaa8, item=0x7f29cc012fb8, copy_func=0x7f29df699dc8, from_field=0x7f29cc04be38, default_field=0x7f29cc04be18, group=false, modify_item=false, table_cant_handle_bit_fields=false, make_copy_field=true) at /data/src/10.4/sql/sql_select.cc:18039
      #11 0x000056515c3bff9b in create_tmp_table (thd=0x7f29cc000d90, param=0x7f29cc017d90, fields=..., group=0x0, distinct=false, save_sum_fields=true, select_options=2416184064, rows_limit=18446744073709551615, table_alias=0x56515d8566e0 <empty_clex_str>, do_not_open=false, keep_row_order=false) at /data/src/10.4/sql/sql_select.cc:18416
      #12 0x000056515c7bb444 in Item_func_group_concat::setup (this=0x7f29cc042218, thd=0x7f29cc000d90) at /data/src/10.4/sql/item_sum.cc:4206
      #13 0x000056515c7bc653 in Aggregator_simple::setup (this=0x7f29cc017cc8, thd=0x7f29cc000d90) at /data/src/10.4/sql/item_sum.h:714
      #14 0x000056515c3dfff2 in Item_sum::aggregator_setup (this=0x7f29cc042218, thd=0x7f29cc000d90) at /data/src/10.4/sql/item_sum.h:546
      #15 0x000056515c3d2bba in setup_sum_funcs (thd=0x7f29cc000d90, func_ptr=0x7f29cc016230) at /data/src/10.4/sql/sql_select.cc:25396
      #16 0x000056515c396687 in JOIN::make_aggr_tables_info (this=0x7f29cc014b50) at /data/src/10.4/sql/sql_select.cc:3621
      #17 0x000056515c393eb1 in JOIN::optimize_stage2 (this=0x7f29cc014b50) at /data/src/10.4/sql/sql_select.cc:3008
      #18 0x000056515c39169e in JOIN::optimize_inner (this=0x7f29cc014b50) at /data/src/10.4/sql/sql_select.cc:2294
      #19 0x000056515c38ef09 in JOIN::optimize (this=0x7f29cc014b50) at /data/src/10.4/sql/sql_select.cc:1615
      #20 0x000056515c39a3f1 in mysql_select (thd=0x7f29cc000d90, tables=0x7f29cc013800, wild_num=0, fields=..., conds=0x0, og_num=1, order=0x0, group=0x7f29cc013ff0, having=0x0, proc_param=0x0, select_options=2416184064, result=0x7f29cc014a58, unit=0x7f29cc004cc0, select_lex=0x7f29cc0128e0) at /data/src/10.4/sql/sql_select.cc:4681
      #21 0x000056515c389e9b in handle_select (thd=0x7f29cc000d90, lex=0x7f29cc004c00, result=0x7f29cc014a58, setup_tables_done_option=0) at /data/src/10.4/sql/sql_select.cc:410
      #22 0x000056515c440643 in Sql_cmd_create_table_like::execute (this=0x7f29cc0121b8, thd=0x7f29cc000d90) at /data/src/10.4/sql/sql_table.cc:11459
      #23 0x000056515c34e19d in mysql_execute_command (thd=0x7f29cc000d90) at /data/src/10.4/sql/sql_parse.cc:6098
      #24 0x000056515c353743 in mysql_parse (thd=0x7f29cc000d90, rawbuf=0x7f29cc012088 "CREATE TABLE t2 AS SELECT a, GROUP_CONCAT(LENGTH(a), 1/ROW_COUNT()) AS f FROM t1 GROUP BY a WITH ROLLUP", length=103, parser_state=0x7f29df69b550, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:7896
      #25 0x000056515c33fc4e in dispatch_command (command=COM_QUERY, thd=0x7f29cc000d90, packet=0x7f29cc0087a1 "CREATE TABLE t2 AS SELECT a, GROUP_CONCAT(LENGTH(a), 1/ROW_COUNT()) AS f FROM t1 GROUP BY a WITH ROLLUP", packet_length=103, is_com_multi=false, is_next_command=false) at /data/src/10.4/sql/sql_parse.cc:1834
      #26 0x000056515c33e4b6 in do_command (thd=0x7f29cc000d90) at /data/src/10.4/sql/sql_parse.cc:1352
      #27 0x000056515c4cc315 in do_handle_one_connection (connect=0x56515f7fcb30) at /data/src/10.4/sql/sql_connect.cc:1412
      #28 0x000056515c4cc05e in handle_one_connection (arg=0x56515f7fcb30) at /data/src/10.4/sql/sql_connect.cc:1316
      #29 0x000056515cee4c96 in pfs_spawn_thread (arg=0x56515f6f9490) at /data/src/10.4/storage/perfschema/pfs.cc:1869
      #30 0x00007f29e9c59609 in start_thread (arg=<optimized out>) at pthread_create.c:477
      #31 0x00007f29e982d293 in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:95
      

      Reproducible with at least MyISAM and InnoDB.

      Attachments

        Issue Links

          Activity

            People

              sanja Oleksandr Byelkin
              elenst Elena Stepanova
              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.