Show
added a comment - It happens here:
#0 JOIN::optimize (this=this@entry=0x607200225f60) at /home/psergey/dev-git/10.0/sql/sql_select.cc:1022
#1 0x00000000007d050b in mysql_select (thd=thd@entry=0x608600037270, rref_pointer_array=rref_pointer_array@entry=0x6072002087b8, tables=<optimized out>, wild_num=<optimized out>, fields=..., conds=<optimized out>, og_num=<optimized out>, og_num@entry=0, order=<optimized out>, group=<optimized out>, having=<optimized out>, proc_param=<optimized out>, proc_param@entry=0x0, select_options=<optimized out>, select_options@entry=2147748612, result=<optimized out>, result@entry=0x607200210600, unit=<optimized out>, unit@entry=0x607200207e50, select_lex=<optimized out>, select_lex@entry=0x607200208540) at /home/psergey/dev-git/10.0/sql/sql_select.cc:3296
#2 0x00000000007d171d in mysql_explain_union (thd=thd@entry=0x608600037270, unit=unit@entry=0x607200207e50, result=result@entry=0x607200210600) at /home/psergey/dev-git/10.0/sql/sql_select.cc:23995
#3 0x00000000007d1ade in select_describe (join=join@entry=0x607200209178, need_tmp_table=<optimized out>, need_order=<optimized out>, distinct=<optimized out>, message=<optimized out>) at /home/psergey/dev-git/10.0/sql/sql_select.cc:23952
#4 0x00000000007d3570 in JOIN::exec_inner (this=this@entry=0x607200209178) at /home/psergey/dev-git/10.0/sql/sql_select.cc:2568
#5 0x00000000007da8a3 in JOIN::exec (this=this@entry=0x607200209178) at /home/psergey/dev-git/10.0/sql/sql_select.cc:2370
#6 0x00000000007d068e in mysql_select (thd=thd@entry=0x608600037270, rref_pointer_array=rref_pointer_array@entry=0x60860003b8e8, tables=<optimized out>, wild_num=<optimized out>, fields=..., conds=<optimized out>, og_num=<optimized out>, order=<optimized out>, order@entry=0x0, group=<optimized out>, having=<optimized out>, proc_param=<optimized out>, proc_param@entry=0x0, select_options=<optimized out>, select_options@entry=3489925892, result=<optimized out>, result@entry=0x607200210600, unit=<optimized out>, unit@entry=0x60860003af80, select_lex=<optimized out>, select_lex@entry=0x60860003b670) at /home/psergey/dev-git/10.0/sql/sql_select.cc:3310
#7 0x00000000007d0c84 in handle_select (thd=thd@entry=0x608600037270, lex=lex@entry=0x60860003aeb8, result=result@entry=0x607200210600, setup_tables_done_option=setup_tables_done_option@entry=1073741824) at /home/psergey/dev-git/10.0/sql/sql_select.cc:373
Going up, we see that select_describe() calls mysql_explain_union for the VIEW here:
/*
Display subqueries only if they are not parts of eliminated WHERE/ON
clauses.
*/
if (!(unit->item && unit->item->eliminated))
{
if (mysql_explain_union(thd, unit, result))
DBUG_VOID_RETURN;
}
I think we should not try to run JOIN::optimize() on a VIEW that has been merged.
I suppose, it is important that the statement is INSERT ... SELECT. This is a case of special kind of VIEW merging. Need to discuss this with Oleksandr Byelkin .
Looking at where explain_node may be uninitialized.
Added an assert:
and removed the corresponding else-branch. This is useful but doesn't fix the warning.