summaryrefslogtreecommitdiff
path: root/mysql-test/r
diff options
context:
space:
mode:
authorunknown <evgen@moonbone.local>2006-02-14 16:22:37 +0300
committerunknown <evgen@moonbone.local>2006-02-14 16:22:37 +0300
commit315a46138e881149e596d15b739995a9ae8b9ddf (patch)
treee6ac903dd104e65ccb3459c20d17158e9a4b8ca9 /mysql-test/r
parent4e8f2a12bc0145224af14138aee964902b88648e (diff)
downloadmariadb-git-315a46138e881149e596d15b739995a9ae8b9ddf.tar.gz
Fixed bug#16272: IF function with decimal args can produce wrong result
The Item_func_if::fix_length_and_dec() function when calculating length of result doesn't take into account unsigned_flag. But it is taken when calculating length of temporary field. This result in creating field that shorter than needed. Due to this, in the reported query 40.0 converted to 9.99. The function Item_func_if::fix_length_and_dec() now adds 1 to the max_length if the unsigned_flag isn't set. sql/item_cmpfunc.cc: Fixed bug#16272: IF function with decimal args can produce wrong result The function Item_func_if::fix_length_and_dec() now adds 1 to the max_length if the unsigned_flag isn't set. mysql-test/r/func_if.result: Added test case for bug#16272: IF function with decimal args can produce wrong result mysql-test/t/func_if.test: Added test case for bug#16272: IF function with decimal args can produce wrong result
Diffstat (limited to 'mysql-test/r')
-rw-r--r--mysql-test/r/func_if.result7
1 files changed, 7 insertions, 0 deletions
diff --git a/mysql-test/r/func_if.result b/mysql-test/r/func_if.result
index aee23b38ca5..eef380c8f52 100644
--- a/mysql-test/r/func_if.result
+++ b/mysql-test/r/func_if.result
@@ -121,3 +121,10 @@ a NULLIF(a,'')
NULL NULL
NULL
DROP TABLE t1;
+create table t1 (f1 int, f2 int);
+insert into t1 values(1,1),(0,0);
+select f1, f2, if(f1, 40.0, 5.00) from t1 group by f1 order by f2;
+f1 f2 if(f1, 40.0, 5.00)
+0 0 5.00
+1 1 40.00
+drop table t1;