-
unknown authored
The problem was in that the code that analyses the applicability of the QUICK_GROUP_MIN_MAX access method for DISTINC queries assumed that there are no duplicate column references in the DISTINCT clause, and it added non-exiting key parts for the duplicate column references. The solution adds a test to check whether the select list already contained a field with the same name. If such field was already present, then it was already decided to use its key part for index access. In this such case we must skip the duplicate field instead of counting it as a new field. mysql-test/r/group_min_max.result: Added test results for BUG#8532. mysql-test/t/group_min_max.test: Added tests for BUG#8532. sql/opt_range.cc: The problem was in that the code that analyses the applicability of the QUICK_GROUP_MIN_MAX access method for DISTINC queries assumed that there are no duplicate column references in the DISTINCT clause, and it added non-exiting key parts for the duplicate column references. The solution adds a test to check whether the select list already contained a field with the same name. If such field was already present, then it was already decided to use its key part for index access. In this such case we must skip the duplicate field instead of counting it as a new field.
b4c7217d