summaryrefslogtreecommitdiff
path: root/sql/item_sum.cc
diff options
context:
space:
mode:
authorVarun Gupta <varun.gupta@mariadb.com>2020-08-10 14:11:58 +0530
committerVarun Gupta <varun.gupta@mariadb.com>2020-08-13 12:24:14 +0530
commit696edd9e7e4119cb54fa1019b0dc7eebbfce31d6 (patch)
treee819f7605c443c1067281a722e10f3a3ca34e841 /sql/item_sum.cc
parentc6686d2cd65dc31b9ec56ef695e8d2f4dc34e48f (diff)
downloadmariadb-git-10.2-varun.tar.gz
MDEV-23438: Assertion `!field->is_null()' failed in my_decimal::my_decimal fails in ONLY_FULL_GROUP_BY mode10.2-varun
The issue here is query with aggregate function and non-aggregate field in the SELECT LIST with ONLY_FULL_GROUP_BY was not disallowed. In ONLY_FULL_GROUP_BY mode non-aggregate fields are only allowed inside an aggregate functions or the non-aggregate fields are part of the GROUP BY clause. In the query for the failing assert the non-aggregate field was inside a WINDOW function and the window function was treated as an aggregate function and so no error was thrown. The fix would be to make sure to mark that a non-aggregate field is used inside a window function and not an aggregate function and throw an error then.
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r--sql/item_sum.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index e50822e71f2..9f68a89a7c8 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -84,7 +84,9 @@ bool Item_sum::init_sum_func_check(THD *thd)
/* Set a reference to the nesting set function if there is any */
in_sum_func= thd->lex->in_sum_func;
/* Save a pointer to object to be used in items for nested set functions */
- thd->lex->in_sum_func= this;
+ if (!window_func_sum_expr_flag)
+ thd->lex->in_sum_func= this;
+
nest_level= thd->lex->current_select->nest_level;
ref_by= 0;
aggr_level= -1;