• unknown's avatar
    Fix of LP BUG#780386. · 73003814
    unknown authored
    ALL subquery should return TRUE if subquery rowa set is empty independently
    of left part.  The problem was that Item_func_(eq,ne,gt,ge,lt,le) do not
    call execution of second argument if first is NULL no in this case subquery
    will not be executed and when Item_func_not_all calls any_value() of the
    subquery or aggregation function which report that there was rows. So for
    NULL < ALL (SELECT...) result was FALSE instead of TRUE.
    
    Fix is just swapping of arguments of Item_func_(eq,ne,gt,ge,lt,le) (with
    changing the operation if it is needed) so that result will be the same
    (for examole a < b is equal to b > a). This fix exploit the fact that
    first argument will be executed in any case.
    
    mysql-test/r/subselect.result:
      The test suite added.
    mysql-test/r/subselect_no_mat.result:
      The test suite added.
    mysql-test/r/subselect_no_opts.result:
      The test suite added.
    mysql-test/r/subselect_no_semijoin.result:
      The test suite added.
    mysql-test/r/subselect_scache.result:
      The test suite added.
    mysql-test/t/subselect.test:
      The test suite added.
    sql/item_cmpfunc.cc:
      Swap arguments creation methods added.
    sql/item_cmpfunc.h:
      Swap arguments creation methods added.
    sql/item_subselect.cc:
      Swap arguments of the comparison.
    73003814
subselect_scache.result 176 KB