• unknown's avatar
    Fix LP BUG#715027 · 2aeb4170
    unknown authored
    Analysis:
    Before calling:
      write_record= (select->skip_record(thd) > 0);
    the function find_all_keys needs to restore the original read/write
    sets of the table that is sorted if the condition select->cond
    contains a subquery.
    
    This didn't happen in this test case because the flag "with_subselect"
    was not set properly for select->cond.
    
    The reason for the flag not being set properly, was that this condition
    was rewritten by add_cond_and_fix() inside make_join_select() by:
    
          /* Add conditions added by add_not_null_conds(). */
          if (tab->select_cond)
            add_cond_and_fix(thd, &tmp, tab->select_cond);
    
    However, the function add_cond_and_fix() called the shortcut method
    Item::quick_fix_field() that didn't update the "with_subselect"
    property.
    
    Solution:
    Call the complete Item::fix_fields() to update all Item properties,
    including "with_subselect".
    2aeb4170
subselect_mat_cost.result 163 KB