[MDEV-23337] Rounding functions create a wrong data type for integer input Created: 2020-07-30  Updated: 2020-07-31  Resolved: 2020-07-31

Status: Closed
Project: MariaDB Server
Component/s: Data types
Affects Version/s: 10.1, 10.2, 10.3, 10.4, 10.5
Fix Version/s: 10.4.14, 10.5.5

Type: Bug Priority: Major
Reporter: Alexander Barkov Assignee: Alexander Barkov
Resolution: Fixed Votes: 0
Labels: None

Issue Links:
Relates
relates to MDEV-23032 FLOOR()/CEIL() incorrectly calculate ... Closed
relates to MDEV-23350 ROUND(bigint_22_or_longer) returns a ... Closed

 Description   

CREATE OR REPLACE TABLE t1 (a BIGINT);
CREATE OR REPLACE TABLE t2 AS SELECT
  a, ROUND(a), TRUNCATE(a,0), FLOOR(a), CEILING(a) FROM t1;
DESC t2;

+---------------+---------------+------+-----+---------+-------+
| Field         | Type          | Null | Key | Default | Extra |
+---------------+---------------+------+-----+---------+-------+
| a             | bigint(20)    | YES  |     | NULL    |       |
| ROUND(a)      | bigint(19)    | YES  |     | NULL    |       |
| TRUNCATE(a,0) | bigint(19)    | YES  |     | NULL    |       |
| FLOOR(a)      | decimal(19,0) | YES  |     | NULL    |       |
| CEILING(a)    | decimal(19,0) | YES  |     | NULL    |       |
+---------------+---------------+------+-----+---------+-------+

The data types for all columns with functions are not equal to the original data type. Looks wrong. All data types are expected to be bigint(20).


Generated at Thu Feb 08 09:21:39 UTC 2024 using Jira 8.20.16#820016-sha1:9d11dbea5f4be3d4cc21f03a88dd11d8c8687422.