summaryrefslogtreecommitdiff
path: root/sql
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2017-06-21 12:14:35 +0400
committerAlexander Barkov <bar@mariadb.org>2017-06-21 12:14:35 +0400
commited61fddf241e2e7e1b3b4db8e60fd1f939568bdd (patch)
tree3dc3afddc92f0b65aac7e18e56be3725a994f519 /sql
parent3a7201ea922f6d3373924c413fdb4b108f6208c5 (diff)
parent0992be927e1c686c39c39fe53fc2a7869d55143d (diff)
downloadmariadb-git-ed61fddf241e2e7e1b3b4db8e60fd1f939568bdd.tar.gz
Merge remote-tracking branch 'origin/10.2' into bb-10.2-ext
Diffstat (limited to 'sql')
-rw-r--r--sql/sql_base.cc7
1 files changed, 5 insertions, 2 deletions
diff --git a/sql/sql_base.cc b/sql/sql_base.cc
index 9fab6c5e252..e272a0e4a7f 100644
--- a/sql/sql_base.cc
+++ b/sql/sql_base.cc
@@ -7108,10 +7108,13 @@ bool setup_fields(THD *thd, Ref_ptr_array ref_pointer_array,
split_sum_func() must be called for Window Function items, see
Item_window_func::split_sum_func.
*/
- if ((item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM &&
- sum_func_list) || item->with_window_func)
+ if (sum_func_list &&
+ ((item->with_sum_func && item->type() != Item::SUM_FUNC_ITEM) ||
+ item->with_window_func))
+ {
item->split_sum_func(thd, ref_pointer_array, *sum_func_list,
SPLIT_SUM_SELECT);
+ }
thd->lex->current_select->select_list_tables|= item->used_tables();
thd->lex->used_tables|= item->used_tables();
thd->lex->current_select->cur_pos_in_select_list++;