Details
-
Bug
-
Status: Closed (View Workflow)
-
Minor
-
Resolution: Fixed
-
10.0(EOL), 10.1(EOL), 10.2(EOL)
-
None
-
10.1.15, 10.2.2-1
Description
SELECT CAST(9999999999999999999e0 AS UNSIGNED) AS c1, CAST(9999999999999999999.0 AS UNSIGNED) AS c2;
|
returns
+---------------------+---------------------+
|
| c1 | c2 |
|
+---------------------+---------------------+
|
| 9223372036854775807 | 9999999999999999999 |
|
+---------------------+---------------------+
|
The c1 value looks wrong.
Note, implicit cast on INSERT works fine:
DROP TABLE IF EXISTS t1; |
CREATE TABLE t1 (a BIGINT UNSIGNED); |
INSERT INTO t1 VALUES (9999999999999999999e0); |
SELECT * FROM t1 |
+----------------------+
|
| a |
|
+----------------------+
|
| 10000000000000000000 |
|
+----------------------+
|
Attachments
Issue Links
- relates to
-
MDEV-19502 TIME_ROUND_FRACTIONAL is not respected on TIME->BIGINT conversion
-
- Open
-
Negative numbers also do not convert well:
+------------------------+--------------------------+
| CAST(-1e0 AS UNSIGNED) | CAST(-1e308 AS UNSIGNED) |
+------------------------+--------------------------+
| 18446744073709551615 | 9223372036854775808 |
+------------------------+--------------------------+
The expected result is to return 0 in both cases, similar to what happens in case of DECIMAL:
+------------------------+
| CAST(-1.0 AS UNSIGNED) |
+------------------------+
| 0 |
+------------------------+
Note, implicit cast on INSERT works as expected:
+------+
| a |
+------+
| 0 |
+------+