Details
-
Bug
-
Status: Open (View Workflow)
-
Major
-
Resolution: Unresolved
-
10.4(EOL)
Description
MySQL rounds fractional seconds on implicit TIME->BIGINT conversion and on explicit CAST:
SET sql_mode=''; -- MySQL rounds by default |
DROP TABLE IF EXISTS t1; |
CREATE TABLE t1 (a BIGINT); |
INSERT INTO t1 VALUES (TIME'-00:00:01.6'); |
SELECT a, CAST(TIME'-00:00:01.6' AS SIGNED) FROM t1; |
+------+-----------------------------------+
|
| a | CAST(TIME'-00:00:01.6' AS SIGNED) |
|
+------+-----------------------------------+
|
| -2 | -2 |
|
+------+-----------------------------------+
|
MariaDB truncates:
SET sql_mode='TIME_ROUND_FRACTIONAL'; |
DROP TABLE IF EXISTS t1; |
CREATE TABLE t1 (a BIGINT); |
INSERT INTO t1 VALUES (TIME'-00:00:01.6'); |
SELECT a, CAST(TIME'-00:00:01.6' AS SIGNED) FROM t1; |
+------+-----------------------------------+
|
| a | CAST(TIME'-00:00:01.6' AS SIGNED) |
|
+------+-----------------------------------+
|
| -1 | -1 |
|
+------+-----------------------------------+
|
Attachments
Issue Links
- relates to
-
MDEV-16991 Rounding vs truncation for TIME, DATETIME, TIMESTAMP
- Closed
-
MDEV-8919 Wrong result for CAST(9999999999999999999.0)
- Closed