summaryrefslogtreecommitdiff
path: root/sql/item_sum.cc
diff options
context:
space:
mode:
authorAlexander Barkov <bar@mariadb.org>2016-08-08 16:04:40 +0400
committerAlexander Barkov <bar@mariadb.org>2016-08-08 16:04:40 +0400
commit1b3430a5ae6b2f6d5c251f1ff07f5c273b1dc175 (patch)
treebdd6adb32750fb059a58083597390d11ee56d565 /sql/item_sum.cc
parent5e23b6344f3b229edcb0d9c42ec23b689c329a38 (diff)
downloadmariadb-git-1b3430a5ae6b2f6d5c251f1ff07f5c273b1dc175.tar.gz
MDEV-10500 CASE/IF Statement returns multiple values and shifts further result values to the next column
We assume all around the code that null_value==true is in sync with NULL value returned by val_str()/val_decimal(). Item_sum_sum::val_decimal() erroneously returned a non-NULL value together with null_value set to true. Fixing to return NULL instead.
Diffstat (limited to 'sql/item_sum.cc')
-rw-r--r--sql/item_sum.cc2
1 files changed, 1 insertions, 1 deletions
diff --git a/sql/item_sum.cc b/sql/item_sum.cc
index adf48f6feec..445895111ed 100644
--- a/sql/item_sum.cc
+++ b/sql/item_sum.cc
@@ -1462,7 +1462,7 @@ my_decimal *Item_sum_sum::val_decimal(my_decimal *val)
if (aggr)
aggr->endup();
if (hybrid_type == DECIMAL_RESULT)
- return (dec_buffs + curr_dec_buff);
+ return null_value ? NULL : (dec_buffs + curr_dec_buff);
return val_decimal_from_real(val);
}