• gkodinov/kgeorge@magare.gmz's avatar
    Bug #27659: · aefc060f
    gkodinov/kgeorge@magare.gmz authored
    The optimizer transforms DISTINCT into a GROUP BY
    when possible.
    It does that by constructing the same structure
    (a list of ORDER instances) the parser makes when
    parsing GROUP BY.
    While doing that it also eliminates duplicates.
    But if a duplicate is found it doesn't advance the
    pointer to ref_pointer array, so the next 
    (and subsequent) ORDER structures point to the wrong
    element in the SELECT list.
    Fixed by advancing the pointer in ref_pointer_array
    even in the case of a duplicate.
    aefc060f
distinct.result 22.3 KB