• unknown's avatar
    Fix LP BUG#685411 · 4f28dcbe
    unknown authored
    Analysis:
    The assert failed because st_select_lex::print() was called for subqueries
    as follows:
    
    Item_subselect::print() ->
      subselect_single_select_engine::print() -> st_select_lex::print()
    
    It was Item_subselect::fix_fields() that set the thd by calling set_thd(),
    so when this print() was called before fix_fields(), subselect_engine::thd
    was NULL.
    
    Solution:
    The patch makes all constructors of all subselect_engine classes to take
    a THD parameter. The default subselect_single_select_engine engine is created
    early during parse time, in the Item_subselect::init call, so we pass the
    correct THD object already at this point.
    4f28dcbe
item_subselect.cc 147 KB