• timour@mysql.com's avatar
    Fix for BUG#11044 - "SELECT DISTINCT on indexed column returns inconsistent results" · 37a84e52
    timour@mysql.com authored
    The problem was that when there was no MIN or MAX function, after finding the
    group prefix based on the DISTINCT or GROUP BY attributes we did not search further
    for a key in the group that satisfies the equi-join conditions on attributes that
    follow the group attributes. Thus we ended up with the wrong rows, and subsequent
    calls to select_cond->val_int() in evaluate_join_record() were filtering those
    rows. Hence - the query result set was empty.
    
    The problem occured both for GROUP BY queries without MIN/MAX and for queries
    with DISTINCT (which were internally executed as GROUP BY queries).
    37a84e52
opt_range.cc 266 KB