-
unknown 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. mysql-test/r/distinct.result: Bug #27659: test case mysql-test/t/distinct.test: Bug #27659: test case sql/sql_select.cc: Bug #27659: use correct ref_pointer_array element
041767e1