diff options
author | Alexander Barkov <bar@mariadb.org> | 2016-08-08 16:04:40 +0400 |
---|---|---|
committer | Alexander Barkov <bar@mariadb.org> | 2016-08-08 16:04:40 +0400 |
commit | 1b3430a5ae6b2f6d5c251f1ff07f5c273b1dc175 (patch) | |
tree | bdd6adb32750fb059a58083597390d11ee56d565 /mysql-test/r/func_group.result | |
parent | 5e23b6344f3b229edcb0d9c42ec23b689c329a38 (diff) | |
download | mariadb-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 'mysql-test/r/func_group.result')
-rw-r--r-- | mysql-test/r/func_group.result | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/mysql-test/r/func_group.result b/mysql-test/r/func_group.result index ac076ec4348..0253548236c 100644 --- a/mysql-test/r/func_group.result +++ b/mysql-test/r/func_group.result @@ -2270,3 +2270,30 @@ t2_id GROUP_CONCAT(IF (t6.b, t6.f, t5.f) ORDER BY 1) EXECUTE stmt; t2_id GROUP_CONCAT(IF (t6.b, t6.f, t5.f) ORDER BY 1) DROP TABLE t1,t2,t3,t4,t5,t6; +# +# MDEV-10500 CASE/IF Statement returns multiple values and shifts further result values to the next column +# +CREATE TABLE t1 ( +id int not null AUTO_INCREMENT, +active bool not null, +data1 bigint, +data2 bigint, +data3 bigint, +primary key (id) +); +INSERT INTO t1 (active,data1,data2,data3) VALUES (1,null,100,200); +SELECT +CASE WHEN active THEN SUM(data1) END AS C_1, +SUM(data2) AS C_2, +SUM(data3) AS C_3 +FROM t1; +C_1 C_2 C_3 +NULL 100 200 +SELECT +IF(active, SUM(data1), 5) AS C_1, +SUM(data2) AS C_2, +SUM(data3) AS C_3 +FROM t1; +C_1 C_2 C_3 +NULL 100 200 +DROP TABLE t1; |