• unknown's avatar
    Fix LP BUG#680005 · fb215f76
    unknown authored
    Analysis:
    This another instance of the problem fixed in LP BUG#675981 -
    evaluation of subqueries during EXPLAIN when the subquery plan
    is incomplete because JOIN::optimize() generally doesn't create
    complete execution plans for EXPLAIN statements.
    
    In this case the call path is:
    mysql_explain_union -> outer_join.exec -> outer_join.init_execution ->
    create_sort_index -> filesort -> find_all_keys ->
    SQL_SELECT::skip_record -> outer_where_clause.val_int -> ...
    -> subselect_join.exec -> ... -> sub_select_cache
    
    When calling sub_select_cache JOIN_TAB::cache is NULL because the cache
    objects are not created for EXPLAIN statements.
    
    Solution:
    Delay the call to init_execution() after all EXPLAIN related processing
    is completed. Thus init_execution() is not called at all during EXPLAIN.
    fb215f76
sql_select.cc 628 KB