Details
-
Bug
-
Status: Open (View Workflow)
-
Minor
-
Resolution: Unresolved
-
5.3.12, 5.5.36, 10.0.9
-
None
-
None
Description
This SQL script:
DROP TABLE IF EXISTS t1;
|
CREATE TABLE t1 (a DOUBLE, b FLOAT);
|
INSERT INTO t1 VALUES (1.1e30,1.2e30);
|
SELECT CAST(a AS SIGNED),CAST(b as SIGNED) FROM t1;
|
SHOW WARNINGS;
|
returns a wrong result for the FLOAT field:
+---------------------+----------------------+
|
| CAST(a AS SIGNED) | CAST(b as SIGNED) |
|
+---------------------+----------------------+
|
| 9223372036854775807 | -9223372036854775808 |
|
+---------------------+----------------------+
|
1 row in set, 1 warning (0.00 sec)
|
The expected result should be 9223372036854775807,
the same with the DOUBLE field.
Also, a warning is not generated for the FLOAT field.
It is generated for the DOUBLE field only:
+---------+------+---------------------------------------------+
|
| Level | Code | Message |
|
+---------+------+---------------------------------------------+
|
| Warning | 1292 | Truncated incorrect INTEGER value: '1.1e30' |
|
+---------+------+---------------------------------------------+
|
1 row in set (0.00 sec)
|
FLOAT should be fixed to generate warnings, like DOUBLE does.