diff options
author | unknown <ramil@mysql.com> | 2005-04-27 17:20:29 +0500 |
---|---|---|
committer | unknown <ramil@mysql.com> | 2005-04-27 17:20:29 +0500 |
commit | 2ae36fd5e7e13a54b03512606162570cff76cedb (patch) | |
tree | 8a255e8ad92535fbe88fc1586a105d3cff4dfffc | |
parent | 18bbc26d4ff6a7f366b4a87756b47c15dd0ae902 (diff) | |
parent | 1d602012651eee7e1441006c3efd7562af1b105d (diff) | |
download | mariadb-git-2ae36fd5e7e13a54b03512606162570cff76cedb.tar.gz |
Merge rkalimullin@bk-internal.mysql.com:/home/bk/mysql-4.1
into mysql.com:/usr/home/ram/work/4.1.b9803
-rw-r--r-- | mysql-test/r/func_math.result | 11 | ||||
-rw-r--r-- | mysql-test/t/func_math.test | 13 | ||||
-rw-r--r-- | sql/item_func.cc | 2 |
3 files changed, 26 insertions, 0 deletions
diff --git a/mysql-test/r/func_math.result b/mysql-test/r/func_math.result index 3a28cccfac5..9cb1e4a56d6 100644 --- a/mysql-test/r/func_math.result +++ b/mysql-test/r/func_math.result @@ -1,3 +1,4 @@ +drop table if exists t1; select floor(5.5),floor(-5.5); floor(5.5) floor(-5.5) 5 -6 @@ -126,3 +127,13 @@ Warnings: Note 1003 select degrees(pi()) AS `degrees(pi())`,radians(360) AS `radians(360)` select rand(rand); ERROR 42S22: Unknown column 'rand' in 'field list' +create table t1 select round(1, 6); +show create table t1; +Table Create Table +t1 CREATE TABLE `t1` ( + `round(1, 6)` double(7,6) NOT NULL default '0.000000' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +select * from t1; +round(1, 6) +1.000000 +drop table t1; diff --git a/mysql-test/t/func_math.test b/mysql-test/t/func_math.test index 668aefc2d8d..4c24dae8c5d 100644 --- a/mysql-test/t/func_math.test +++ b/mysql-test/t/func_math.test @@ -2,6 +2,10 @@ # Test of math functions # +--disable_warnings +drop table if exists t1; +--enable_warnings + select floor(5.5),floor(-5.5); explain extended select floor(5.5),floor(-5.5); select ceiling(5.5),ceiling(-5.5); @@ -58,3 +62,12 @@ explain extended select degrees(pi()),radians(360); --error 1054 select rand(rand); + +# +# Bug #9837: problem with round() +# + +create table t1 select round(1, 6); +show create table t1; +select * from t1; +drop table t1; diff --git a/sql/item_func.cc b/sql/item_func.cc index eb6e395c266..2b38584fe23 100644 --- a/sql/item_func.cc +++ b/sql/item_func.cc @@ -1072,6 +1072,8 @@ void Item_func_round::fix_length_and_dec() decimals=0; else decimals=min(tmp,NOT_FIXED_DEC); + if ((tmp= decimals - args[0]->decimals) > 0) + max_length+= tmp; } } |