• unknown's avatar
    Fix for bug MDEV-765 (LP:825075) · 12bd3ddf
    unknown authored
    Analys:
    The cause for the wrong result was that the optimizer
    incorrectly chose min/max loose scan when it is not
    applicable. The applicability test missed the case when
    a condition on the MIN/MAX argument was OR-ed with a
    condition on some other field. In this case, the MIN/MAX
    condition cannot be used for loose scan.
    
    Solution:
    Extend the test check_group_min_max_predicates() to check
    that the WHERE clause is of the form: "cond1 AND cond2"
    where 
      cond1 - does not use min_max_column at all.
      cond2 - is an AND/OR tree with leaves in form "min_max_column $CMP$ const"
              or $CMP$ is one of the functions between, is [not] null
    
    12bd3ddf
group_min_max.test 55.9 KB