summaryrefslogtreecommitdiff
path: root/sql/item_sum.cc
diff options
context:
space:
mode:
authorIgor Babaev <igor@askmonty.org>2017-02-01 19:15:28 -0800
committerIgor Babaev <igor@askmonty.org>2017-02-01 19:15:28 -0800
commit8481c70ede067b576d5b1576a9b68042e84368fb (patch)
tree568c142550bde93e45e7d5a39ae32cff42b2a7cf /sql/item_sum.cc
parent69114862f21dadb5c660847c691cc24456c90970 (diff)
downloadmariadb-git-8481c70ede067b576d5b1576a9b68042e84368fb.tar.gz
Fixed bug mdev-11867.
If a window function with aggregation is over the result set of a grouping query then the argument of the aggregate function from the window function is allowed to be an aggregate function itself.
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r--sql/item_sum.cc3
1 files changed, 3 insertions, 0 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index 51a6c2bd3eb..23f8638b724 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -151,6 +151,8 @@ bool Item_sum::check_sum_func(THD *thd, Item **ref)
curr_sel->name_visibility_map);
bool invalid= FALSE;
DBUG_ASSERT(curr_sel->name_visibility_map); // should be set already
+ if (window_func_sum_expr_flag)
+ return false;
/*
The value of max_arg_level is updated if an argument of the set function
contains a column reference resolved against a subquery whose level is
@@ -460,6 +462,7 @@ void Item_sum::mark_as_sum_func()
const_item_cache= false;
with_sum_func= 1;
with_field= 0;
+ window_func_sum_expr_flag= false;
}