• Georgi Kodinov's avatar
    Bug #45386: Wrong query result with MIN function in field list, · 3e82a86e
    Georgi Kodinov authored
    WHERE and GROUP BY clause
    
    Loose index scan may use range conditions on the argument of 
    the MIN/MAX aggregate functions to find the beginning/end of 
    the interval that satisfies the range conditions in a single go.
    These range conditions may have open or closed minimum/maximum 
    values. When the comparison returns 0 (equal) the code should 
    check the type of the min/max values of the current interval 
    and accept or reject the row based on whether the limit is 
    open or not.
    There was a wrong composite condition on checking this and it was
    not working in all cases.
    Fixed by simplifying the conditions and reversing the logic.
    
    mysql-test/r/group_min_max.result:
      Bug #45386: test case
    mysql-test/t/group_min_max.test:
      Bug #45386: test case
    sql/opt_range.cc:
      Bug #45386: fix the check whether to use the value if on the
      interval boundry
    3e82a86e
opt_range.cc 302 KB