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

Assertion `table_list->table' failed in find_field_in_table_ref

    Details

      Description

      create table t1(a int);
      insert into t1 values (3), (1), (2);
      create table t2 (b int);
      insert into t2 values (2), (10);
       
      prepare stmt from "create or replace view v1 as
      with t as (select s.a from (select t1.a from t1) s),
           r as(select t.a from t2, t where t2.b=t.a)
       select a from r;";
       
      execute stmt;
      

      #6  0x00007fb54db1cbd7 in __assert_fail_base (fmt=<optimized out>, assertion=assertion@entry=0x555c1a86c2b5 "table_list->table", file=file@entry=0x555c1a86b558 "10.4/sql/sql_base.cc", line=line@entry=5851, function=function@entry=0x555c1a86dee0 <find_field_in_table_ref(THD*, TABLE_LIST*, char const*, unsigned long, char const*, char const*, char const*, Item**, bool, bool, unsigned int*, bool, TABLE_LIST**)::__PRETTY_FUNCTION__> "Field* find_field_in_table_ref(THD*, TABLE_LIST*, const char*, size_t, const char*, const char*, const char*, Item**, bool, bool, uint*, bool, TABLE_LIST**)") at assert.c:92
      #7  0x00007fb54db1cc82 in __GI___assert_fail (assertion=0x555c1a86c2b5 "table_list->table", file=0x555c1a86b558 "10.4/sql/sql_base.cc", line=5851, function=0x555c1a86dee0 <find_field_in_table_ref(THD*, TABLE_LIST*, char const*, unsigned long, char const*, char const*, char const*, Item**, bool, bool, unsigned int*, bool, TABLE_LIST**)::__PRETTY_FUNCTION__> "Field* find_field_in_table_ref(THD*, TABLE_LIST*, const char*, size_t, const char*, const char*, const char*, Item**, bool, bool, uint*, bool, TABLE_LIST**)") at assert.c:101
      #8  0x0000555c19c74475 in find_field_in_table_ref (thd=0x7fb4f4000b00, table_list=0x7fb4f40467e0, name=0x7fb4f40452f8 "a", length=1, item_name=0x7fb4f40452f8 "a", db_name=0x0, table_name=0x7fb4f40452f0 "s", ref=0x7fb4f4045418, check_privileges=true, allow_rowid=true, cached_field_index_ptr=0x7fb4f40453d4, register_tree_change=true, actual_table=0x7fb54200e9a0) at 10.4/sql/sql_base.cc:5851
      #9  0x0000555c19c7504e in find_field_in_tables (thd=0x7fb4f4000b00, item=0x7fb4f4045300, first_table=0x7fb4f40467e0, last_table=0x0, ref=0x7fb4f4045418, report_error=IGNORE_EXCEPT_NON_UNIQUE, check_privileges=true, register_tree_change=true) at 10.4/sql/sql_base.cc:6153
      #10 0x0000555c1a01eed5 in Item_field::fix_fields (this=0x7fb4f4045300, thd=0x7fb4f4000b00, reference=0x7fb4f4045418) at 10.4/sql/item.cc:5782
      #11 0x0000555c19c03b29 in Item::fix_fields_if_needed (this=0x7fb4f4045300, thd=0x7fb4f4000b00, ref=0x7fb4f4045418) at 10.4/sql/item.h:938
      #12 0x0000555c19c03b57 in Item::fix_fields_if_needed_for_scalar (this=0x7fb4f4045300, thd=0x7fb4f4000b00, ref=0x7fb4f4045418) at 10.4/sql/item.h:942
      #13 0x0000555c19c77e83 in setup_fields (thd=0x7fb4f4000b00, ref_pointer_array=..., fields=..., column_usage=MARK_COLUMNS_READ, sum_func_list=0x7fb4f4015668, pre_fix=0x7fb4f4045008, allow_sum_func=true) at 10.4/sql/sql_base.cc:7348
      #14 0x0000555c19d42d61 in JOIN::prepare (this=0x7fb4f4015348, tables_init=0x7fb4f40467e0, 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=0x7fb4f4044ec0, unit_arg=0x7fb4f4046e48) at 10.4/sql/sql_select.cc:1099
      #15 0x0000555c19df277d in st_select_lex_unit::prepare_join (this=0x7fb4f4046e48, thd_arg=0x7fb4f4000b00, sl=0x7fb4f4044ec0, tmp_result=0x7fb4f4015260, additional_options=0, is_union_select=false) at 10.4/sql/sql_union.cc:654
      #16 0x0000555c19df3ce0 in st_select_lex_unit::prepare (this=0x7fb4f4046e48, derived_arg=0x7fb4f4048338, sel_result=0x7fb4f4015260, additional_options=0) at 10.4/sql/sql_union.cc:977
      #17 0x0000555c19cb3034 in mysql_derived_prepare (thd=0x7fb4f4000b00, lex=0x7fb4f4042c40, derived=0x7fb4f4048338) at 10.4/sql/sql_derived.cc:767
      #18 0x0000555c19cb1e17 in mysql_handle_single_derived (lex=0x7fb4f4042c40, derived=0x7fb4f4048338, phases=2) at 10.4/sql/sql_derived.cc:198
      #19 0x0000555c19e214fa in TABLE_LIST::handle_derived (this=0x7fb4f4048338, lex=0x7fb4f4042c40, phases=2) at 10.4/sql/table.cc:8149
      #20 0x0000555c19cd55d7 in st_select_lex::handle_derived (this=0x7fb4f4047708, lex=0x7fb4f4042c40, phases=2) at 10.4/sql/sql_lex.cc:4162
      #21 0x0000555c19cb2ec2 in mysql_derived_prepare (thd=0x7fb4f4000b00, lex=0x7fb4f4042c40, derived=0x7fb4f4049c30) at 10.4/sql/sql_derived.cc:737
      #22 0x0000555c19cb1bcf in mysql_handle_derived (lex=0x7fb4f4042c40, phases=2) at 10.4/sql/sql_derived.cc:122
      #23 0x0000555c19c723cc in open_normal_and_derived_tables (thd=0x7fb4f4000b00, tables=0x7fb4f4049c30, flags=512, dt_phases=2) at 10.4/sql/sql_base.cc:5015
      #24 0x0000555c19d25af3 in mysql_test_create_view (stmt=0x7fb4f41965e0) at 10.4/sql/sql_prepare.cc:2027
      #25 0x0000555c19d26690 in check_prepared_statement (stmt=0x7fb4f41965e0) at 10.4/sql/sql_prepare.cc:2415
      #26 0x0000555c19d2a2a2 in Prepared_statement::prepare (this=0x7fb4f41965e0, packet=0x7fb4f4015040 "create or replace view v1 as\nwith t as (select s.a from (select t1.a from t1) s),\n     r as(select t.a from t2, t where t2.b=t.a)\n select a from r;", packet_len=147) at 10.4/sql/sql_prepare.cc:3986
      #27 0x0000555c19d27267 in mysql_sql_stmt_prepare (thd=0x7fb4f4000b00) at 10.4/sql/sql_prepare.cc:2819
      #28 0x0000555c19d00d23 in mysql_execute_command (thd=0x7fb4f4000b00) at 10.4/sql/sql_parse.cc:3782
      #29 0x0000555c19d0e681 in mysql_parse (thd=0x7fb4f4000b00, rawbuf=0x7fb4f4014e88 "prepare stmt from \"create or replace view v1 as\nwith t as (select s.a from (select t1.a from t1) s),\n     r as(select t.a from t2, t where t2.b=t.a)\n select a from r;\"", length=167, parser_state=0x7fb542010470, is_com_multi=false, is_next_command=false) at 10.4/sql/sql_parse.cc:8084
      #30 0x0000555c19cfb754 in dispatch_command (command=COM_QUERY, thd=0x7fb4f4000b00, packet=0x7fb4f4093d31 "prepare stmt from \"create or replace view v1 as\nwith t as (select s.a from (select t1.a from t1) s),\n     r as(select t.a from t2, t where t2.b=t.a)\n select a from r;\"", packet_length=167, is_com_multi=false, is_next_command=false) at 10.4/sql/sql_parse.cc:1850
      #31 0x0000555c19cfa171 in do_command (thd=0x7fb4f4000b00) at 10.4/sql/sql_parse.cc:1395
      #32 0x0000555c19e61021 in do_handle_one_connection (connect=0x555c1e15fdd0) at 10.4/sql/sql_connect.cc:1402
      #33 0x0000555c19e60d72 in handle_one_connection (arg=0x555c1e15fdd0) at 10.4/sql/sql_connect.cc:1308
      #34 0x0000555c1a745b08 in pfs_spawn_thread (arg=0x555c1e1e41a0) at 10.4/storage/perfschema/pfs.cc:1862
      #35 0x00007fb54e7616ba in start_thread (arg=0x7fb542011700) at pthread_create.c:333
      #36 0x00007fb54dbf641d in clone () at ../sysdeps/unix/sysv/linux/x86_64/clone.S:109
      
      

      maybe a variation of MDEV-16992

        Attachments

          Issue Links

            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:
                  Resolved: