[MDEV-23282] FLOAT(53,0) badly handles out-of-range values Created: 2020-07-24  Updated: 2020-07-27  Resolved: 2020-07-27

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

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

Issue Links:
Blocks
blocks MDEV-23162 Improve Protocol performance for nume... Closed

 Description   

I create a table with a FLOAT column and insert a value outside of the float supported range:

CREATE OR REPLACE TABLE t1(c1 FLOAT NOT NULL);
INSERT IGNORE INTO t1 VALUES (1e+40);
SELECT c1 FROM t1;

+------------+
| c1         |
+------------+
| 3.40282e38 |
+------------+

Looks good so far. It truncated the value to the maximum supported FLOAT value, and a corresponding warning was issued.

Now I do the same with a column of the data type FLOAT(53,0):

CREATE OR REPLACE TABLE t1(c1 FLOAT(53,0) NOT NULL);
INSERT IGNORE INTO t1 VALUES (1e+40);
SELECT c1 FROM t1;

+----+
| c1 |
+----+
|  0 |
+----+

It silently truncated the value to 0. This is wrong. The expected value should be a huge FLOAT value with a warning.


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