mirror of
https://github.com/MariaDB/server.git
synced 2025-01-18 13:02:28 +01:00
A fix (bug #9837: round(1, 6) delivers wrong value in create table context).
This commit is contained in:
parent
49b4af7bf6
commit
775010a40d
3 changed files with 26 additions and 0 deletions
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue