summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorunknown <gkodinov/kgeorge@magare.gmz>2007-11-20 16:07:24 +0200
committerunknown <gkodinov/kgeorge@magare.gmz>2007-11-20 16:07:24 +0200
commit162f8bed8d81bc5bd32273833a2fc3726eba2fef (patch)
treec3e3b463047c97fcdc32cdec89a7922e82721da4 /sql/sql_select.cc
parenta3d78175291c294ecc63449b8ba1dced48676d1d (diff)
downloadmariadb-git-162f8bed8d81bc5bd32273833a2fc3726eba2fef.tar.gz
Bug #32268: Indexed queries give bogus MIN and MAX results
Loose index scan does the grouping so the temp table does not need to do it, even when sorting. Fixed by checking if the grouping is already done before doing sorting and grouping in a temp table and do only sorting. mysql-test/r/group_min_max.result: Bug #32268: test case mysql-test/t/group_min_max.test: Bug #32268: test case sql/sql_select.cc: Bug #32268: don't group in the temp table if already done
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc3
1 files changed, 2 insertions, 1 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index 3d3b8668a79..757bfb3a29e 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -10256,7 +10256,8 @@ Next_select_func setup_end_select_func(JOIN *join)
/* Set up select_end */
if (table)
{
- if (table->group && tmp_tbl->sum_func_count)
+ if (table->group && tmp_tbl->sum_func_count &&
+ !tmp_tbl->precomputed_group_by)
{
if (table->s->keys)
{