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

Assertion `outer_context || !*from_field || *from_field == not_found_field' failed in Item_field::fix_outer_field or Assertion `!derived->is_excluded()' failed in TABLE_LIST::set_check_materialized

    Details

    • Type: Bug
    • Status: Confirmed (View Workflow)
    • Priority: Major
    • Resolution: Unresolved
    • Affects Version/s: 5.5, 10.0, 10.1, 10.2, 10.3, 10.4
    • Fix Version/s: 5.5, 10.0, 10.1, 10.2, 10.3, 10.4
    • Component/s: None
    • Labels:
      None

      Description

      create table t1 (a int) ;
       
      delimiter $$;
      create procedure t1_data()
      begin
        declare i int default 1;
        while i < 1000 do insert into t1 values (i); set i = i + 1;
        end while;
      end$$
      delimiter ;$$
       
      call t1_data();
      create procedure sp() select * from (select a from t1) tb;
      call sp();
      set optimizer_switch='derived_merge=off';
      call sp();
      

      or the same with prepared statement:

      prepare stmt from "select * from (select a from t1) tb;";
      execute stmt;
      set optimizer_switch='derived_merge=off';
      execute stmt;
      

      #5  0x00007f95c8c9402a in __GI_abort () at abort.c:89
      #6  0x00007f95c8c8abd7 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0xe1d190 "outer_context || !*from_field || *from_field == not_found_field", file=file@entry=0xe1cb80 "/5.5/sql/item.cc", line=line@entry=4761, function=function@entry=0xe1ebc0 <Item_field::fix_outer_field(THD*, Field**, Item**)::__PRETTY_FUNCTION__> "int Item_field::fix_outer_field(THD*, Field**, Item**)") at assert.c:92
      #7  0x00007f95c8c8ac82 in __GI___assert_fail (assertion=0xe1d190 "outer_context || !*from_field || *from_field == not_found_field", file=0xe1cb80 "/5.5/sql/item.cc", line=4761, function=0xe1ebc0 <Item_field::fix_outer_field(THD*, Field**, Item**)::__PRETTY_FUNCTION__> "int Item_field::fix_outer_field(THD*, Field**, Item**)") at assert.c:101
      #8  0x00000000007f820e in Item_field::fix_outer_field (this=0x7f95c3940e68, thd=0x7f95c53e6060, from_field=0x7f95ca50b5d8, reference=0x7f95c393dfa0) at /5.5/sql/item.cc:4760
      #9  0x00000000007f9520 in Item_field::fix_fields (this=0x7f95c3940e68, thd=0x7f95c53e6060, reference=0x7f95c393dfa0) at /5.5/sql/item.cc:5168
      #10 0x0000000000801463 in Item_direct_view_ref::fix_fields (this=0x7f95c3939650, thd=0x7f95c53e6060, reference=0x7f95c3940e30) at /5.5/sql/item.cc:7933
      #11 0x00000000005b71d5 in setup_fields (thd=0x7f95c53e6060, ref_pointer_array=0x7f95c3939760, fields=..., mark_used_columns=MARK_COLUMNS_READ, sum_func_list=0x7f95c3945510, pre_fix=0x7f95c3940280, allow_sum_func=true) at /5.5/sql/sql_base.cc:8216
      #12 0x0000000000642651 in JOIN::prepare (this=0x7f95c39451c0, rref_pointer_array=0x7f95c39403f0, tables_init=0x7f95c3939078, wild_num=0, conds_init=0x0, og_num=0, order_init=0x0, skip_order_by=false, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x7f95c3940150, unit_arg=0x7f95c393fa68) at /5.5/sql/sql_select.cc:733
      #13 0x000000000064b7db in mysql_select (thd=0x7f95c53e6060, rref_pointer_array=0x7f95c39403f0, tables=0x7f95c3939078, wild_num=0, fields=..., conds=0x0, og_num=0, order=0x0, group=0x0, having=0x0, proc_param=0x0, select_options=2147749632, result=0x7f95c39451a0, unit=0x7f95c393fa68, select_lex=0x7f95c3940150) at /5.5/sql/sql_select.cc:3113
      #14 0x000000000064176d in handle_select (thd=0x7f95c53e6060, lex=0x7f95c393f9b8, result=0x7f95c39451a0, setup_tables_done_option=0) at /5.5/sql/sql_select.cc:324
      #15 0x0000000000617562 in execute_sqlcom_select (thd=0x7f95c53e6060, all_tables=0x7f95c3939078) at /5.5/sql/sql_parse.cc:4684
      #16 0x000000000061001c in mysql_execute_command (thd=0x7f95c53e6060) at /5.5/sql/sql_parse.cc:2222
      #17 0x000000000091e978 in sp_instr_stmt::exec_core (this=0x7f95c393dd40, thd=0x7f95c53e6060, nextp=0x7f95ca50c89c) at /5.5/sql/sp_head.cc:3221
      #18 0x000000000091e0e0 in sp_lex_keeper::reset_lex_and_exec_core (this=0x7f95c393dd80, thd=0x7f95c53e6060, nextp=0x7f95ca50c89c, open_tables=false, instr=0x7f95c393dd40) at /5.5/sql/sp_head.cc:2999
      #19 0x000000000091e684 in sp_instr_stmt::execute (this=0x7f95c393dd40, thd=0x7f95c53e6060, nextp=0x7f95ca50c89c) at /5.5/sql/sp_head.cc:3145
      #20 0x000000000091a021 in sp_head::execute (this=0x7f95c393f078, thd=0x7f95c53e6060, merge_da_on_success=true) at /5.5/sql/sp_head.cc:1432
      #21 0x000000000091bfab in sp_head::execute_procedure (this=0x7f95c393f078, thd=0x7f95c53e6060, args=0x7f95c53ea028) at /5.5/sql/sp_head.cc:2198
      #22 0x00000000006158bc in mysql_execute_command (thd=0x7f95c53e6060) at /5.5/sql/sql_parse.cc:4121
      #23 0x000000000061a47c in mysql_parse (thd=0x7f95c53e6060, rawbuf=0x7f95c38c4078 "call sp()", length=9, parser_state=0x7f95ca50d660) at /5.5/sql/sql_parse.cc:5929
      #24 0x000000000060d3c4 in dispatch_command (command=COM_QUERY, thd=0x7f95c53e6060, packet=0x7f95c46f4061 "call sp()", packet_length=9) at /5.5/sql/sql_parse.cc:1067
      #25 0x000000000060c529 in do_command (thd=0x7f95c53e6060) at /5.5/sql/sql_parse.cc:793
      #26 0x0000000000723ec4 in do_handle_one_connection (thd_arg=0x7f95c53e6060) at /5.5/sql/sql_connect.cc:1268
      #27 0x0000000000723c2d in handle_one_connection (arg=0x7f95c53e6060) at /5.5/sql/sql_connect.cc:1184
      #28 0x0000000000cc6db9 in pfs_spawn_thread (arg=0x7f95c469c300) at /5.5/storage/perfschema/pfs.cc:1015
      #29 0x00007f95c98bd6ba in start_thread (arg=0x7f95ca50e700) at pthread_create.c:333
      #30 0x00007f95c8d6441d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
      
      

      10.2 3b234104ae227556f06c

      #4  0x00007f56dc2af428 in __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:54
      #5  0x00007f56dc2b102a in __GI_abort () at abort.c:89
      #6  0x00007f56dc2a7bd7 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x562a4f36f49b "!derived->is_excluded()", file=file@entry=0x562a4f36dfa8 "/10.2/sql/table.cc", line=line@entry=5641, function=function@entry=0x562a4f370b60 <TABLE_LIST::set_check_materialized()::__PRETTY_FUNCTION__> "void TABLE_LIST::set_check_materialized()") at assert.c:92
      #7  0x00007f56dc2a7c82 in __GI___assert_fail (assertion=0x562a4f36f49b "!derived->is_excluded()", file=0x562a4f36dfa8 "/10.2/sql/table.cc", line=5641, function=0x562a4f370b60 <TABLE_LIST::set_check_materialized()::__PRETTY_FUNCTION__> "void TABLE_LIST::set_check_materialized()") at assert.c:101
      #8  0x0000562a4e96fc2f in TABLE_LIST::set_check_materialized (this=0x7f5680043c40) at /10.2/sql/table.cc:5641
      #9  0x0000562a4e7fe059 in TABLE_LIST::set_materialized_derived (this=0x7f5680043c40) at /10.2/sql/table.h:2362
      #10 0x0000562a4e975b37 in TABLE_LIST::init_derived (this=0x7f5680043c40, thd=0x7f5680000b00, init_view=true) at /10.2/sql/table.cc:8119
      #11 0x0000562a4e830f7b in mysql_derived_init (thd=0x7f5680000b00, lex=0x7f56800425d8, derived=0x7f5680043c40) at /10.2/sql/sql_derived.cc:557
      #12 0x0000562a4e830224 in mysql_handle_derived (lex=0x7f56800425d8, phases=1) at /10.2/sql/sql_derived.cc:122
      #13 0x0000562a4e7f3931 in open_and_lock_tables (thd=0x7f5680000b00, options=..., tables=0x7f5680043c40, derived=true, flags=0, prelocking_strategy=0x7f56d4121060) at /10.2/sql/sql_base.cc:4827
      #14 0x0000562a4e7e64e8 in open_and_lock_tables (thd=0x7f5680000b00, tables=0x7f5680043c40, derived=true, flags=0) at /10.2/sql/sql_base.h:509
      #15 0x0000562a4e86a513 in execute_sqlcom_select (thd=0x7f5680000b00, all_tables=0x7f5680043c40) at /10.2/sql/sql_parse.cc:6147
      #16 0x0000562a4e8613c0 in mysql_execute_command (thd=0x7f5680000b00) at /10.2/sql/sql_parse.cc:3533
      #17 0x0000562a4ec6415e in sp_instr_stmt::exec_core (this=0x7f5680044268, thd=0x7f5680000b00, nextp=0x7f56d4122064) at /10.2/sql/sp_head.cc:3248
      #18 0x0000562a4ec637cf in sp_lex_keeper::reset_lex_and_exec_core (this=0x7f56800442a8, thd=0x7f5680000b00, nextp=0x7f56d4122064, open_tables=false, instr=0x7f5680044268) at /10.2/sql/sp_head.cc:3011
      #19 0x0000562a4ec63e07 in sp_instr_stmt::execute (this=0x7f5680044268, thd=0x7f5680000b00, nextp=0x7f56d4122064) at /10.2/sql/sp_head.cc:3164
      #20 0x0000562a4ec5efca in sp_head::execute (this=0x7f5680040538, thd=0x7f5680000b00, merge_da_on_success=true) at /10.2/sql/sp_head.cc:1329
      #21 0x0000562a4ec61063 in sp_head::execute_procedure (this=0x7f5680040538, thd=0x7f5680000b00, args=0x7f5680005440) at /10.2/sql/sp_head.cc:2118
      #22 0x0000562a4e85f92d in do_execute_sp (thd=0x7f5680000b00, sp=0x7f5680040538) at /10.2/sql/sql_parse.cc:2955
      #23 0x0000562a4e868090 in mysql_execute_command (thd=0x7f5680000b00) at /10.2/sql/sql_parse.cc:5573
      #24 0x0000562a4e86e85b in mysql_parse (thd=0x7f5680000b00, rawbuf=0x7f5680012468 "call sp()", length=9, parser_state=0x7f56d4123080, is_com_multi=false, is_next_command=false) at /10.2/sql/sql_parse.cc:7760
      #25 0x0000562a4e85cb24 in dispatch_command (command=COM_QUERY, thd=0x7f5680000b00, packet=0x7f5680096021 "call sp()", packet_length=9, is_com_multi=false, is_next_command=false) at /10.2/sql/sql_parse.cc:1832
      #26 0x0000562a4e85b438 in do_command (thd=0x7f5680000b00) at /10.2/sql/sql_parse.cc:1386
      #27 0x0000562a4e9b0b8d in do_handle_one_connection (connect=0x562a51cd6420) at /10.2/sql/sql_connect.cc:1336
      #28 0x0000562a4e9b08f8 in handle_one_connection (arg=0x562a51cd6420) at /10.2/sql/sql_connect.cc:1241
      #29 0x0000562a4f1db886 in pfs_spawn_thread (arg=0x562a51ce1210) at /10.2/storage/perfschema/pfs.cc:1862
      #30 0x00007f56dceec6ba in start_thread (arg=0x7f56d4124700) at pthread_create.c:333
      #31 0x00007f56dc38141d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
      
      

      10.2.26

      190812 11:39:33 [ERROR] mysqld got signal 11 ;
       
      sql/sql_lex.cc:2497(st_select_lex::mark_as_dependent(THD*, st_select_lex*, Item*))[0x55dc63e8e067]
      sql/item.cc:4677(mark_as_dependent(THD*, st_select_lex*, st_select_lex*, Item_ident*, Item_ident*))[0x55dc64035608]
      sql/item.cc:5363(Item_field::fix_outer_field(THD*, Field**, Item**))[0x55dc6404609e]
      sql/item.cc:5555(Item_field::fix_fields(THD*, Item**))[0x55dc640466b7]
      sql/item.cc:8584(Item_direct_view_ref::fix_fields(THD*, Item**))[0x55dc64042ce7]
      sql/sql_base.cc:7203(setup_fields(THD*, Bounds_checked_array<Item*>, List<Item>&, enum_mark_columns, List<Item>*, List<Item>*, bool))[0x55dc63e5dd2b]
      sql/sql_select.cc:815(JOIN::prepare(TABLE_LIST*, unsigned int, Item*, unsigned int, st_order*, bool, st_order*, Item*, st_order*, st_select_lex*, st_select_lex_unit*))[0x55dc63edb6fd]
      sql/sql_select.cc:3800(mysql_select(THD*, TABLE_LIST*, unsigned int, List<Item>&, Item*, unsigned int, st_order*, st_order*, Item*, st_order*, unsigned long long, select_result*, st_select_lex_unit*, st_select_lex*))[0x55dc63eecce6]
      sql/sql_select.cc:377(handle_select(THD*, LEX*, select_result*, unsigned long))[0x55dc63eede04]
      sql/sql_parse.cc:6227(execute_sqlcom_select(THD*, TABLE_LIST*))[0x55dc63ddddea]
      sql/sql_parse.cc:3533(mysql_execute_command(THD*))[0x55dc63e9c84d]
      sql/sp_head.cc:3250(sp_instr_stmt::exec_core(THD*, unsigned int*))[0x55dc6412868e]
      sql/sp_head.cc:3011(sp_lex_keeper::reset_lex_and_exec_core(THD*, unsigned int*, bool, sp_instr*))[0x55dc6412e3c9]
      sql/sp_head.cc:3165(sp_instr_stmt::execute(THD*, unsigned int*))[0x55dc6412e905]
      sql/sp_head.cc:1331(sp_head::execute(THD*, bool))[0x55dc6412b76a]
      sql/sp_head.cc:2118(sp_head::execute_procedure(THD*, List<Item>*))[0x55dc6412cb8e]
      sql/sql_parse.cc:2958(do_execute_sp(THD*, sp_head*))[0x55dc63e93f67]
      sql/sql_parse.cc:5573(mysql_execute_command(THD*))[0x55dc63e9ecc4]
      sql/sql_parse.cc:7760(mysql_parse(THD*, char*, unsigned int, Parser_state*, bool, bool))[0x55dc63ea12ea]
      sql/sql_parse.cc:1832(dispatch_command(enum_server_command, THD*, char*, unsigned int, bool, bool))[0x55dc63ea37ee]
      sql/sql_parse.cc:1388(do_command(THD*))[0x55dc63ea3ddd]
      sql/sql_connect.cc:1336(do_handle_one_connection(CONNECT*))[0x55dc63f65f11]
      sql/sql_connect.cc:1243(handle_one_connection)[0x55dc63f65fe4]
      /lib/x86_64-linux-gnu/libpthread.so.0(+0x76ba)[0x7f42e63166ba]
      x86_64/clone.S:111(clone)[0x7f42e59c141d]
       
      Query (0x7f427c059ab0): select * from (select a from t1) tb
      

        Attachments

          Activity

            People

            • Assignee:
              igor Igor Babaev
              Reporter:
              alice Alice Sherepa
            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated: