summaryrefslogtreecommitdiff
path: root/sql/opt_range.cc
diff options
context:
space:
mode:
authorSergei Golubchik <sergii@pisem.net>2012-08-09 17:22:00 +0200
committerSergei Golubchik <sergii@pisem.net>2012-08-09 17:22:00 +0200
commitd11829654c4ef5c3d0f997ca61a50d4bd196db8a (patch)
treee48a5775e961b17600bf9c1c189243deb5515ba7 /sql/opt_range.cc
parente022b6ef07529d83e8c1cbd5e3d374fc5cc75721 (diff)
parent704898bf3200af4da42c1bf9251a7da5533db73f (diff)
downloadmariadb-git-d11829654c4ef5c3d0f997ca61a50d4bd196db8a.tar.gz
merge with MySQL 5.5.27
manually checked every change, reverted incorrect or stupid changes.
Diffstat (limited to 'sql/opt_range.cc')
-rw-r--r--sql/opt_range.cc7
1 files changed, 4 insertions, 3 deletions
diff --git a/sql/opt_range.cc b/sql/opt_range.cc
index da328063e56..910bbf2d975 100644
--- a/sql/opt_range.cc
+++ b/sql/opt_range.cc
@@ -11804,9 +11804,10 @@ get_best_group_min_max(PARAM *param, SEL_TREE *tree, double read_time)
have_min= TRUE;
else if (min_max_item->sum_func() == Item_sum::MAX_FUNC)
have_max= TRUE;
- else if (min_max_item->sum_func() == Item_sum::COUNT_DISTINCT_FUNC ||
- min_max_item->sum_func() == Item_sum::SUM_DISTINCT_FUNC ||
- min_max_item->sum_func() == Item_sum::AVG_DISTINCT_FUNC)
+ else if (is_agg_distinct &&
+ (min_max_item->sum_func() == Item_sum::COUNT_DISTINCT_FUNC ||
+ min_max_item->sum_func() == Item_sum::SUM_DISTINCT_FUNC ||
+ min_max_item->sum_func() == Item_sum::AVG_DISTINCT_FUNC))
continue;
else
DBUG_RETURN(NULL);