summaryrefslogtreecommitdiff
path: root/sql/sql_select.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2017-02-15 22:41:45 -0800
committerIgor Babaev <igor@askmonty.org>2017-02-15 22:41:45 -0800
commit37925c6ccc61bd4d5af4956dbd877c69983c09f3 (patch)
treed565559a0e1b610bd0444c792a73971cd6b87ad5 /sql/sql_select.cc
parente688d8144411e38253b7ec4e13f67a989da8bb76 (diff)
downloadmariadb-git-37925c6ccc61bd4d5af4956dbd877c69983c09f3.tar.gz
Fixed bug mdev-9924.
Supported queries with window functions when GROUP BY could be optimized away.
Diffstat (limited to 'sql/sql_select.cc')
-rw-r--r--sql/sql_select.cc5
1 files changed, 4 insertions, 1 deletions
diff --git a/sql/sql_select.cc b/sql/sql_select.cc
index ea0f4891de1..802e0d27e88 100644
--- a/sql/sql_select.cc
+++ b/sql/sql_select.cc
@@ -2226,6 +2226,9 @@ bool JOIN::make_aggr_tables_info()
sort_and_group_aggr_tab= NULL;
+ if (group_optimized_away)
+ implicit_grouping= true;
+
bool implicit_grouping_with_window_funcs= implicit_grouping &&
select_lex->have_window_funcs();
@@ -2574,7 +2577,7 @@ bool JOIN::make_aggr_tables_info()
tmp_table_param.copy_field= tmp_table_param.copy_field_end=0;
first_record= sort_and_group=0;
- if (!group_optimized_away)
+ if (!group_optimized_away || implicit_grouping_with_window_funcs)
{
group= false;
}