Commit 6a2ee9c8 authored by Alexander Barkov's avatar Alexander Barkov

MDEV-23032 FLOOR()/CEIL() incorrectly calculate the precision of a DECIMAL(M,D) column

The code in Item_func_int_val::fix_length_and_dec_int_or_decimal()
calculated badly the result data type for FLOOR()/CEIL(), so for example
the decimal(38,10) input created a decimal(28,0) result.
That was not correct, because one extra integer digit is needed.
   floor(-9.9) -> -10
   ceil(9.9)   ->  10

Rewritting the code in a more straightforward way.
Additional changes:
- FLOOR() now takes into account the presence of the UNSIGNED
flag of the argument: FLOOR(unsigned decimal) does not need an extra digits.
- FLOOR()/CEILING() now preserve the unsigned flag in the result
  data type is decimal.
These changes give nicer data types.
parent 706a7101
Branches unavailable
Tags unavailable
No related merge requests found
......@@ -194,12 +194,12 @@ show create table t1;
drop table t1;
select hex(concat(ceiling(0.5)));
create table t1 as select concat(ceiling(0.5)) as c1;
create table t1 as select ceiling(0.5) as c0, concat(ceiling(0.5)) as c1;
show create table t1;
drop table t1;
select hex(concat(floor(0.5)));
create table t1 as select concat(floor(0.5)) as c1;
create table t1 as select floor(0.5) as c0, concat(floor(0.5)) as c1;
show create table t1;
drop table t1;
......
......@@ -348,21 +348,23 @@ drop table t1;
select hex(concat(ceiling(0.5)));
hex(concat(ceiling(0.5)))
31
create table t1 as select concat(ceiling(0.5)) as c1;
create table t1 as select ceiling(0.5) as c0, concat(ceiling(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varbinary(4) DEFAULT NULL
`c0` int(3) NOT NULL,
`c1` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(floor(0.5)));
hex(concat(floor(0.5)))
30
create table t1 as select concat(floor(0.5)) as c1;
create table t1 as select floor(0.5) as c0, concat(floor(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varbinary(4) DEFAULT NULL
`c0` int(3) NOT NULL,
`c1` varbinary(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(round(0.5)));
......
......@@ -757,21 +757,23 @@ drop table t1;
select hex(concat(ceiling(0.5)));
hex(concat(ceiling(0.5)))
31
create table t1 as select concat(ceiling(0.5)) as c1;
create table t1 as select ceiling(0.5) as c0, concat(ceiling(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(4) CHARACTER SET cp1251 DEFAULT NULL
`c0` int(3) NOT NULL,
`c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(floor(0.5)));
hex(concat(floor(0.5)))
30
create table t1 as select concat(floor(0.5)) as c1;
create table t1 as select floor(0.5) as c0, concat(floor(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(4) CHARACTER SET cp1251 DEFAULT NULL
`c0` int(3) NOT NULL,
`c1` varchar(3) CHARACTER SET cp1251 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(round(0.5)));
......
......@@ -1066,21 +1066,23 @@ drop table t1;
select hex(concat(ceiling(0.5)));
hex(concat(ceiling(0.5)))
31
create table t1 as select concat(ceiling(0.5)) as c1;
create table t1 as select ceiling(0.5) as c0, concat(ceiling(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(4) DEFAULT NULL
`c0` int(3) NOT NULL,
`c1` varchar(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(floor(0.5)));
hex(concat(floor(0.5)))
30
create table t1 as select concat(floor(0.5)) as c1;
create table t1 as select floor(0.5) as c0, concat(floor(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(4) DEFAULT NULL
`c0` int(3) NOT NULL,
`c1` varchar(3) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(round(0.5)));
......
......@@ -1950,21 +1950,23 @@ drop table t1;
select hex(concat(ceiling(0.5)));
hex(concat(ceiling(0.5)))
0031
create table t1 as select concat(ceiling(0.5)) as c1;
create table t1 as select ceiling(0.5) as c0, concat(ceiling(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL
`c0` int(3) NOT NULL,
`c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(floor(0.5)));
hex(concat(floor(0.5)))
0030
create table t1 as select concat(floor(0.5)) as c1;
create table t1 as select floor(0.5) as c0, concat(floor(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(4) CHARACTER SET ucs2 DEFAULT NULL
`c0` int(3) NOT NULL,
`c1` varchar(3) CHARACTER SET ucs2 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(round(0.5)));
......
......@@ -2817,21 +2817,23 @@ drop table t1;
select hex(concat(ceiling(0.5)));
hex(concat(ceiling(0.5)))
31
create table t1 as select concat(ceiling(0.5)) as c1;
create table t1 as select ceiling(0.5) as c0, concat(ceiling(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(4) CHARACTER SET utf8 DEFAULT NULL
`c0` int(3) NOT NULL,
`c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(floor(0.5)));
hex(concat(floor(0.5)))
30
create table t1 as select concat(floor(0.5)) as c1;
create table t1 as select floor(0.5) as c0, concat(floor(0.5)) as c1;
show create table t1;
Table Create Table
t1 CREATE TABLE `t1` (
`c1` varchar(4) CHARACTER SET utf8 DEFAULT NULL
`c0` int(3) NOT NULL,
`c1` varchar(3) CHARACTER SET utf8 DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
drop table t1;
select hex(concat(round(0.5)));
......
This diff is collapsed.
......@@ -2411,3 +2411,292 @@ drop table t1;
#
# End of 10.2 tests
#
#
# Start of 10.4 tests
#
#
# MDEV-23032 FLOOR()/CEIL() incorrectly calculate the precision of a DECIMAL(M,D) column.
#
CREATE PROCEDURE p1(prec INT, scale INT, suffix VARCHAR(32))
BEGIN
EXECUTE IMMEDIATE CONCAT('CREATE TABLE t1 (a decimal(',prec,',',scale,')',suffix,')');
INSERT IGNORE INTO t1 VALUES (-1e100), (+1e100);
CREATE TABLE t2 AS SELECT
a,
FLOOR(a) AS fa,
CEILING(a) AS ca,
LENGTH(FLOOR(a)),
LENGTH(CEILING(a))
FROM t1 ORDER BY a;
SHOW CREATE TABLE t2;
SELECT * FROM t2;
DROP TABLE t2, t1;
END;
$$
CALL p1(38,10,'');
Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,10) DEFAULT NULL,
`fa` decimal(29,0) DEFAULT NULL,
`ca` decimal(29,0) DEFAULT NULL,
`LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
`LENGTH(CEILING(a))` int(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a -9999999999999999999999999999.9999999999
fa -10000000000000000000000000000
ca -9999999999999999999999999999
LENGTH(FLOOR(a)) 30
LENGTH(CEILING(a)) 29
a 9999999999999999999999999999.9999999999
fa 9999999999999999999999999999
ca 10000000000000000000000000000
LENGTH(FLOOR(a)) 28
LENGTH(CEILING(a)) 29
CALL p1(28,10,'');
Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(28,10) DEFAULT NULL,
`fa` decimal(19,0) DEFAULT NULL,
`ca` decimal(19,0) DEFAULT NULL,
`LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
`LENGTH(CEILING(a))` int(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a -999999999999999999.9999999999
fa -1000000000000000000
ca -999999999999999999
LENGTH(FLOOR(a)) 20
LENGTH(CEILING(a)) 19
a 999999999999999999.9999999999
fa 999999999999999999
ca 1000000000000000000
LENGTH(FLOOR(a)) 18
LENGTH(CEILING(a)) 19
CALL p1(27,10,'');
Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(27,10) DEFAULT NULL,
`fa` bigint(19) DEFAULT NULL,
`ca` bigint(19) DEFAULT NULL,
`LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
`LENGTH(CEILING(a))` int(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a -99999999999999999.9999999999
fa -100000000000000000
ca -99999999999999999
LENGTH(FLOOR(a)) 19
LENGTH(CEILING(a)) 18
a 99999999999999999.9999999999
fa 99999999999999999
ca 100000000000000000
LENGTH(FLOOR(a)) 17
LENGTH(CEILING(a)) 18
CALL p1(20,10,'');
Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(20,10) DEFAULT NULL,
`fa` bigint(12) DEFAULT NULL,
`ca` bigint(12) DEFAULT NULL,
`LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
`LENGTH(CEILING(a))` int(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a -9999999999.9999999999
fa -10000000000
ca -9999999999
LENGTH(FLOOR(a)) 12
LENGTH(CEILING(a)) 11
a 9999999999.9999999999
fa 9999999999
ca 10000000000
LENGTH(FLOOR(a)) 10
LENGTH(CEILING(a)) 11
CALL p1(19,10,'');
Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(19,10) DEFAULT NULL,
`fa` bigint(11) DEFAULT NULL,
`ca` bigint(11) DEFAULT NULL,
`LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
`LENGTH(CEILING(a))` int(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a -999999999.9999999999
fa -1000000000
ca -999999999
LENGTH(FLOOR(a)) 11
LENGTH(CEILING(a)) 10
a 999999999.9999999999
fa 999999999
ca 1000000000
LENGTH(FLOOR(a)) 9
LENGTH(CEILING(a)) 10
CALL p1(18,10,'');
Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(18,10) DEFAULT NULL,
`fa` int(10) DEFAULT NULL,
`ca` int(10) DEFAULT NULL,
`LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
`LENGTH(CEILING(a))` int(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a -99999999.9999999999
fa -100000000
ca -99999999
LENGTH(FLOOR(a)) 10
LENGTH(CEILING(a)) 9
a 99999999.9999999999
fa 99999999
ca 100000000
LENGTH(FLOOR(a)) 8
LENGTH(CEILING(a)) 9
CALL p1(10,10,'');
Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(10,10) DEFAULT NULL,
`fa` int(2) DEFAULT NULL,
`ca` int(2) DEFAULT NULL,
`LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
`LENGTH(CEILING(a))` int(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a -0.9999999999
fa -1
ca 0
LENGTH(FLOOR(a)) 2
LENGTH(CEILING(a)) 1
a 0.9999999999
fa 0
ca 1
LENGTH(FLOOR(a)) 1
LENGTH(CEILING(a)) 1
CALL p1(38,10,' UNSIGNED');
Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(38,10) unsigned DEFAULT NULL,
`fa` decimal(28,0) unsigned DEFAULT NULL,
`ca` decimal(29,0) unsigned DEFAULT NULL,
`LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
`LENGTH(CEILING(a))` int(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 0.0000000000
fa 0
ca 0
LENGTH(FLOOR(a)) 1
LENGTH(CEILING(a)) 1
a 9999999999999999999999999999.9999999999
fa 9999999999999999999999999999
ca 10000000000000000000000000000
LENGTH(FLOOR(a)) 28
LENGTH(CEILING(a)) 29
CALL p1(28,10,' UNSIGNED');
Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(28,10) unsigned DEFAULT NULL,
`fa` bigint(18) unsigned DEFAULT NULL,
`ca` decimal(19,0) unsigned DEFAULT NULL,
`LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
`LENGTH(CEILING(a))` int(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 0.0000000000
fa 0
ca 0
LENGTH(FLOOR(a)) 1
LENGTH(CEILING(a)) 1
a 999999999999999999.9999999999
fa 999999999999999999
ca 1000000000000000000
LENGTH(FLOOR(a)) 18
LENGTH(CEILING(a)) 19
CALL p1(27,10,' UNSIGNED');
Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(27,10) unsigned DEFAULT NULL,
`fa` bigint(17) unsigned DEFAULT NULL,
`ca` bigint(18) unsigned DEFAULT NULL,
`LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
`LENGTH(CEILING(a))` int(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 0.0000000000
fa 0
ca 0
LENGTH(FLOOR(a)) 1
LENGTH(CEILING(a)) 1
a 99999999999999999.9999999999
fa 99999999999999999
ca 100000000000000000
LENGTH(FLOOR(a)) 17
LENGTH(CEILING(a)) 18
CALL p1(20,10,' UNSIGNED');
Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(20,10) unsigned DEFAULT NULL,
`fa` bigint(10) unsigned DEFAULT NULL,
`ca` bigint(11) unsigned DEFAULT NULL,
`LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
`LENGTH(CEILING(a))` int(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 0.0000000000
fa 0
ca 0
LENGTH(FLOOR(a)) 1
LENGTH(CEILING(a)) 1
a 9999999999.9999999999
fa 9999999999
ca 10000000000
LENGTH(FLOOR(a)) 10
LENGTH(CEILING(a)) 11
CALL p1(19,10,' UNSIGNED');
Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(19,10) unsigned DEFAULT NULL,
`fa` int(9) unsigned DEFAULT NULL,
`ca` bigint(10) unsigned DEFAULT NULL,
`LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
`LENGTH(CEILING(a))` int(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 0.0000000000
fa 0
ca 0
LENGTH(FLOOR(a)) 1
LENGTH(CEILING(a)) 1
a 999999999.9999999999
fa 999999999
ca 1000000000
LENGTH(FLOOR(a)) 9
LENGTH(CEILING(a)) 10
CALL p1(18,10,' UNSIGNED');
Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(18,10) unsigned DEFAULT NULL,
`fa` int(8) unsigned DEFAULT NULL,
`ca` int(9) unsigned DEFAULT NULL,
`LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
`LENGTH(CEILING(a))` int(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 0.0000000000
fa 0
ca 0
LENGTH(FLOOR(a)) 1
LENGTH(CEILING(a)) 1
a 99999999.9999999999
fa 99999999
ca 100000000
LENGTH(FLOOR(a)) 8
LENGTH(CEILING(a)) 9
CALL p1(10,10,' UNSIGNED');
Table t2
Create Table CREATE TABLE `t2` (
`a` decimal(10,10) unsigned DEFAULT NULL,
`fa` int(1) unsigned DEFAULT NULL,
`ca` int(1) unsigned DEFAULT NULL,
`LENGTH(FLOOR(a))` int(10) DEFAULT NULL,
`LENGTH(CEILING(a))` int(10) DEFAULT NULL
) ENGINE=MyISAM DEFAULT CHARSET=latin1
a 0.0000000000
fa 0
ca 0
LENGTH(FLOOR(a)) 1
LENGTH(CEILING(a)) 1
a 0.9999999999
fa 0
ca 1
LENGTH(FLOOR(a)) 1
LENGTH(CEILING(a)) 1
DROP PROCEDURE p1;
......@@ -1871,3 +1871,51 @@ drop table t1;
--echo #
--echo # End of 10.2 tests
--echo #
--echo #
--echo # Start of 10.4 tests
--echo #
--echo #
--echo # MDEV-23032 FLOOR()/CEIL() incorrectly calculate the precision of a DECIMAL(M,D) column.
--echo #
DELIMITER $$;
CREATE PROCEDURE p1(prec INT, scale INT, suffix VARCHAR(32))
BEGIN
EXECUTE IMMEDIATE CONCAT('CREATE TABLE t1 (a decimal(',prec,',',scale,')',suffix,')');
INSERT IGNORE INTO t1 VALUES (-1e100), (+1e100);
CREATE TABLE t2 AS SELECT
a,
FLOOR(a) AS fa,
CEILING(a) AS ca,
LENGTH(FLOOR(a)),
LENGTH(CEILING(a))
FROM t1 ORDER BY a;
SHOW CREATE TABLE t2;
SELECT * FROM t2;
DROP TABLE t2, t1;
END;
$$
DELIMITER ;$$
--vertical_results
CALL p1(38,10,'');
CALL p1(28,10,'');
CALL p1(27,10,'');
CALL p1(20,10,'');
CALL p1(19,10,'');
CALL p1(18,10,'');
CALL p1(10,10,'');
CALL p1(38,10,' UNSIGNED');
CALL p1(28,10,' UNSIGNED');
CALL p1(27,10,' UNSIGNED');
CALL p1(20,10,' UNSIGNED');
CALL p1(19,10,' UNSIGNED');
CALL p1(18,10,' UNSIGNED');
CALL p1(10,10,' UNSIGNED');
--horizontal_results
DROP PROCEDURE p1;
......@@ -2173,35 +2173,64 @@ longlong Item_func_bit_neg::val_int()
void Item_func_int_val::fix_length_and_dec_int_or_decimal()
{
DBUG_ASSERT(args[0]->cmp_type() == DECIMAL_RESULT);
DBUG_ASSERT(args[0]->max_length <= DECIMAL_MAX_STR_LENGTH);
/*
The INT branch of this code should be revised.
It creates too large data types, e.g.
CREATE OR REPLACE TABLE t2 AS SELECT FLOOR(9999999.999) AS fa;
results in a BININT(10) column, while INT(7) should probably be enough.
FLOOR() for negative numbers can increase length: floor(-9.9) -> -10
CEILING() for positive numbers can increase length: ceil(9.9) -> 10
*/
ulonglong tmp_max_length= (ulonglong ) args[0]->max_length -
(args[0]->decimals ? args[0]->decimals + 1 : 0) + 2;
max_length= tmp_max_length > (ulonglong) UINT_MAX32 ?
(uint32) UINT_MAX32 : (uint32) tmp_max_length;
uint tmp= float_length(decimals);
set_if_smaller(max_length,tmp);
decimals= 0;
decimal_round_mode mode= round_mode();
uint length_increase= args[0]->decimals > 0 &&
(mode == CEILING ||
(mode == FLOOR && !args[0]->unsigned_flag)) ? 1 : 0;
uint precision= args[0]->decimal_int_part() + length_increase;
set_if_bigger(precision, 1);
/*
-2 because in most high position can't be used any digit for longlong
and one position for increasing value during operation
The BIGINT data type can store:
UNSIGNED BIGINT: 0..18446744073709551615 - up to 19 digits
SIGNED BIGINT: -9223372036854775808..9223372036854775807 - up to 18 digits
The INT data type can store:
UNSIGNED INT: 0..4294967295 - up to 9 digits
SIGNED INT: -2147483648..2147483647 - up to 9 digits
*/
if (args[0]->max_length - args[0]->decimals >= DECIMAL_LONGLONG_DIGITS - 2)
if (precision > 18)
{
unsigned_flag= args[0]->unsigned_flag;
fix_char_length(
my_decimal_precision_to_length_no_truncation(
args[0]->decimal_int_part(), 0, false));
my_decimal_precision_to_length_no_truncation(precision, 0,
unsigned_flag));
set_handler(&type_handler_newdecimal);
}
else
{
unsigned_flag= args[0]->unsigned_flag;
set_handler(type_handler_long_or_longlong());
uint sign_length= (unsigned_flag= args[0]->unsigned_flag) ? 0 : 1;
fix_char_length(precision + sign_length);
if (precision > 9)
{
#if MYSQL_VERSION_ID > 100500
#error Remove the '#else' branch and the conditional compilation
if (unsigned_flag)
set_handler(&type_handler_ulonglong);
else
set_handler(&type_handler_slonglong);
#else
set_handler(&type_handler_longlong);
#endif
}
else
{
#if MYSQL_VERSION_ID > 100500
#error Remove the '#else' branch and the conditional compilation
if (unsigned_flag)
set_handler(&type_handler_ulong);
else
set_handler(&type_handler_slong);
#else
set_handler(&type_handler_long);
#endif
}
}
}
......
......@@ -1695,6 +1695,7 @@ class Item_func_int_val :public Item_func_hybrid_field_type
Item_func_int_val(THD *thd, Item *a): Item_func_hybrid_field_type(thd, a) {}
bool check_partition_func_processor(void *int_arg) { return FALSE; }
bool check_vcol_func_processor(void *arg) { return FALSE; }
virtual decimal_round_mode round_mode() const= 0;
void fix_length_and_dec_double();
void fix_length_and_dec_int_or_decimal();
void fix_length_and_dec_time()
......@@ -1723,6 +1724,7 @@ class Item_func_ceiling :public Item_func_int_val
public:
Item_func_ceiling(THD *thd, Item *a): Item_func_int_val(thd, a) {}
const char *func_name() const { return "ceiling"; }
decimal_round_mode round_mode() const { return CEILING; }
longlong int_op();
double real_op();
my_decimal *decimal_op(my_decimal *);
......@@ -1738,6 +1740,7 @@ class Item_func_floor :public Item_func_int_val
public:
Item_func_floor(THD *thd, Item *a): Item_func_int_val(thd, a) {}
const char *func_name() const { return "floor"; }
decimal_round_mode round_mode() const { return FLOOR; }
longlong int_op();
double real_op();
my_decimal *decimal_op(my_decimal *);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment