• unknown's avatar
    Fix bug lp:833702 · 64986873
    unknown authored
    Analysis:
    Equality propagation propagated the constant '7' into
    args[0] of the Item_in_optimizer that stands for the
    "< ANY" predicate. At the same the min/max subquery
    rewrite swapped the order of the left and right operands
    of the "<" predicate, but used Item_in_subselect::left_expr.
    
    As a result, when the <ANY predicate is executed early in the
    execution phase as a contant condition, instead of a constant
    right (swapped) argument of the < predicate, there was a field
    (t3.a). This field had no data, since the whole predicate is
    considered constant, and it is evaluated before any tables are
    read. Having junk in the field row buffer produced wrong result
    
    Solution:
    Fix create_swap to pick the correct Item_in_optimizer left
    argument.
    64986873
subselect_no_mat.result 188 KB