Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
10.5, 10.1(EOL), 10.2(EOL), 10.3(EOL), 10.4(EOL)
-
None
Description
MariaDB [test]> create table i1 (a decimal(38,10)); |
Query OK, 0 rows affected (0.057 sec) |
|
MariaDB [test]> create table i2 as select floor(a), ceil(a) from i1; |
Query OK, 0 rows affected (0.019 sec) |
Records: 0 Duplicates: 0 Warnings: 0
|
|
MariaDB [test]> show create table i2; |
+-------+--------------------------------------------------------------------------------------------------------------------------------------------+ |
| Table | Create Table | |
+-------+--------------------------------------------------------------------------------------------------------------------------------------------+ |
| i2 | CREATE TABLE `i2` ( |
`floor(a)` decimal(28,0) DEFAULT NULL, |
`ceil(a)` decimal(28,0) DEFAULT NULL |
) ENGINE=InnoDB DEFAULT CHARSET=latin1 | |
+-------+--------------------------------------------------------------------------------------------------------------------------------------------+ |
1 row in set (0.001 sec) |
|
MariaDB [test]> insert into i1 values (9999999999999999999999999999.9999999999), (-9999999999999999999999999999.9999999999); |
Query OK, 2 rows affected (0.002 sec) |
Records: 2 Duplicates: 0 Warnings: 0
|
|
MariaDB [test]> create table i3 as select floor(a), ceil(a) from i1; |
ERROR 1264 (22003): Out of range value for column 'ceil(a)' at row 1 |
MariaDB [test]> create table i3 as select floor(a) from i1; |
ERROR 1264 (22003): Out of range value for column 'floor(a)' at row 2 |
For DECIMAL(M,0), i2 should have M=29, instead of M=28 as in the above. This is because M can exceed by 1 for FLOOR/CEIL functions, for example, when we insert the 2 rows into i1, the result of the functions would contain 29 digits, instead of 28.
Attachments
Issue Links
- relates to
-
MDEV-20397 Support TIMESTAMP, DATETIME, TIME in ROUND() and TRUNCATE()
- Closed
-
MDEV-23320 Hex hybrid constants 0xHHHH work badly in rounding functions
- Closed
-
MDEV-23323 Rounding functions return a wrong data type for a BIT, ENUM, SET argument
- Closed
-
MDEV-23337 Rounding functions create a wrong data type for integer input
- Closed
-
MDEV-23350 ROUND(bigint_22_or_longer) returns a wrong data type
- Closed
-
MCOL-641 Full DECIMAL support in ColumnStore
- Closed
-
MDEV-23311 CEILING() and FLOOR() convert temporal input to numbers, unlike ROUND() and TRUNCATE()
- Closed
-
MDEV-23351 Rounding functions return wrong data types for DATE input
- Closed
-
MDEV-23366 ROUND(18446744073709551615,rand()*0) returns a wrong result
- Closed
-
MDEV-23367 ROUND(18446744073709551615,-1) returns a wrong result
- Closed