Assertion `table_list->table' failed in find_field_in_table_ref in maria-5.3 with views / WL#106

Bug #806071 reported by Philip Stoev
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
MariaDB
Fix Released
High
Oleksandr "Sanja" Byelkin

Bug Description

Not reproducible before WL#106. Not influenced by derived_merge and derived_with_keys flag. EXPLAIN also crashes.

assertion:

mysqld: sql_base.cc:6201: Field* find_field_in_table_ref(THD*, TABLE_LIST*, const char*, uint, const char*, const char*, const char*, Item**, bool, bool, uint

#6 0x00000033b58296e6 in __assert_fail () from /lib64/libc.so.6
#7 0x00000000006fd7bb in find_field_in_table_ref (thd=0x1cbc7068, table_list=0x1cc83e20, name=0x1cc82d50 "f1", length=2, item_name=0x1cc82d50 "f1",
    db_name=0x0, table_name=0x1cc82d40 "v1", ref=0x1cc84308, check_privileges=true, allow_rowid=true, cached_field_index_ptr=0x1cc842b4,
    register_tree_change=true, actual_table=0x41c63c48) at sql_base.cc:6201
#8 0x00000000006fe141 in find_field_in_tables (thd=0x1cbc7068, item=0x1cc841f8, first_table=0x1cc83e20, last_table=0x0, ref=0x1cc84308,
    report_error=IGNORE_EXCEPT_NON_UNIQUE, check_privileges=true, register_tree_change=true) at sql_base.cc:6491
#9 0x00000000005a6ac8 in Item_field::fix_fields (this=0x1cc841f8, thd=0x1cbc7068, reference=0x1cc84308) at item.cc:4558
#10 0x00000000007284fc in find_order_in_list (thd=0x1cbc7068, ref_pointer_array=0x1cc86040, tables=0x1cc80dd0, order=0x1cc842f8, fields=..., all_fields=...,
    is_group_field=false) at sql_select.cc:18549
#11 0x0000000000728c42 in setup_order (thd=0x1cbc7068, ref_pointer_array=0x1cc86040, tables=0x1cc80dd0, fields=..., all_fields=..., order=0x1cc842f8)
    at sql_select.cc:18645
#12 0x0000000000757dda in setup_without_group (thd=0x1cbc7068, ref_pointer_array=0x1cc86040, tables=0x1cc80dd0, leaves=..., fields=..., all_fields=...,
    conds=0x1ccdf4f8, order=0x1cc4ec10, group=0x0, hidden_group_fields=0x1ccdf3ef) at sql_select.cc:458
#13 0x000000000074d779 in JOIN::prepare (this=0x1ccd9440, rref_pointer_array=0x1cc4e038, tables_init=0x1cc80dd0, wild_num=0, conds_init=0x0, og_num=1,
    order_init=0x1cc4ec10, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x1cc4de18, unit_arg=0x1cc4d930) at sql_select.cc:572
#14 0x000000000089d4fc in st_select_lex_unit::prepare (this=0x1cc4d930, thd_arg=0x1cbc7068, sel_result=0x1cc85f18, additional_options=0) at sql_union.cc:316
#15 0x000000000089f053 in mysql_derived_prepare (thd=0x1cbc7068, lex=0x1cbc9470, derived=0x1cc4cec0) at sql_derived.cc:638
#16 0x000000000089fc7c in mysql_handle_single_derived (lex=0x1cbc9470, derived=0x1cc4cec0, phases=2) at sql_derived.cc:171
#17 0x000000000070ce2d in TABLE_LIST::handle_derived (this=0x1cc4cec0, lex=0x1cbc9470, phases=2) at table.cc:5766
#18 0x000000000057a36f in st_select_lex::handle_derived (this=0x1cbc99f8, lex=0x1cbc9470, phases=2) at sql_lex.cc:3209
#19 0x000000000074d35f in JOIN::prepare (this=0x1cc87d20, rref_pointer_array=0x1cbc9c18, tables_init=0x1cc4cec0, wild_num=1, conds_init=0x0, og_num=2,
    order_init=0x1cc4ec10, group_init=0x0, having_init=0x0, proc_param_init=0x0, select_lex_arg=0x1cbc99f8, unit_arg=0x1cbc9510) at sql_select.cc:510
#20 0x000000000074e7a0 in mysql_select (thd=0x1cbc7068, rref_pointer_array=0x1cbc9c18, tables=0x1cc4cec0, wild_num=1, fields=..., conds=0x0, og_num=2,
    order=0x1cc4ec10, group=0x0, having=0x0, proc_param=0x0, select_options=2147764736, result=0x1cc84be0, unit=0x1cbc9510, select_lex=0x1cbc99f8)
    at sql_select.cc:2867
#21 0x0000000000754c04 in handle_select (thd=0x1cbc7068, lex=0x1cbc9470, result=0x1cc84be0, setup_tables_done_option=0) at sql_select.cc:283
#22 0x00000000006a19e0 in execute_sqlcom_select (thd=0x1cbc7068, all_tables=0x1cc4cec0) at sql_parse.cc:5087
#23 0x00000000006a36be in mysql_execute_command (thd=0x1cbc7068) at sql_parse.cc:2231
#24 0x00000000006ac457 in mysql_parse (thd=0x1cbc7068, rawbuf=0x1cc4ccb0 "SELECT * FROM v4 AS a1, v4 AS a2", length=33, found_semicolon=0x41c65f08)
    at sql_parse.cc:6088
#25 0x00000000006ad2ef in dispatch_command (command=COM_QUERY, thd=0x1cbc7068, packet=0x1cc43939 "SELECT * FROM v4 AS a1, v4 AS a2", packet_length=33)
    at sql_parse.cc:1208
#26 0x00000000006ae8fd in do_command (thd=0x1cbc7068) at sql_parse.cc:906
#27 0x0000000000699373 in handle_one_connection (arg=0x1cbc7068) at sql_connect.cc:1178
#28 0x00000033b600673d in start_thread () from /lib64/libpthread.so.0
#29 0x00000033b58d40cd in clone () from /lib64/libc.so.6

optimizer switch:

index_merge=on,index_merge_union=on,index_merge_sort_union=on,index_merge_intersection=on,index_merge_sort_intersection=off,index_condition_pushdown=on,derived_merge=on,derived_with_keys=on,firstmatch=off,loosescan=off,materialization=off,in_to_exists=on,semijoin=off,partial_match_rowid_merge=on,partial_match_table_scan=on,subquery_cache=on,mrr=on,mrr_cost_based=off,mrr_sort_keys=on,outer_join_with_cache=off,semijoin_with_cache=off,join_cache_incremental=on,join_cache_hashed=on,join_cache_bka=on,optimize_join_buffer_size=on,table_elimination=on

test case:

CREATE TABLE t1 (f1 int);
INSERT INTO t1 VALUES (1),(1);

CREATE ALGORITHM=TEMPTABLE VIEW v1 AS SELECT f1 FROM t1;
CREATE ALGORITHM=MERGE VIEW v2 AS SELECT f1 FROM v1 ORDER BY f1;

SELECT * FROM v2 AS a1, v2 AS a2;

Changed in maria:
milestone: none → 5.3
assignee: nobody → Igor Babaev (igorb-seattle)
summary: Assertion `table_list->table' failed in find_field_in_table_ref in
- maria-5.3
+ maria-5.3 with views / WL#106
Changed in maria:
status: New → Confirmed
importance: Undecided → High
Changed in maria:
status: Confirmed → In Progress
Changed in maria:
assignee: Igor Babaev (igorb-seattle) → Oleksandr "Sanja" Byelkin (sanja-byelkin)
Changed in maria:
status: In Progress → Fix Committed
Changed in maria:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.