Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Fixed
-
5.5(EOL), 10.0(EOL), 10.1(EOL)
-
10.1.8-3
Description
DROP TABLE IF EXISTS t1;
|
CREATE TABLE t1 (a BIGINT(15), b BIGINT(15) ZEROFILL);
|
INSERT INTO t1 VALUES (9,9);
|
SELECT TIME(a),TIME(b) FROM t1;
|
SHOW WARNINGS;
|
returns
+----------+----------+
|
| TIME(a) | TIME(b) |
|
+----------+----------+
|
| 00:00:09 | 00:00:00 |
|
+----------+----------+
|
1 row in set, 1 warning (0.00 sec)
|
with a warning:
+---------+------+---------------------------------------------------+
|
| Level | Code | Message |
|
+---------+------+---------------------------------------------------+
|
| Warning | 1292 | Truncated incorrect time value: '000000000000009' |
|
+---------+------+---------------------------------------------------+
|
The expected behavior is to return '00:00:09' for both columns, with no warnings.
The same problem is repeatable with the DECIMAL data type:
DROP TABLE IF EXISTS t1;
|
CREATE TABLE t1 (a DECIMAL(15,0), b DECIMAL(15,0) ZEROFILL);
|
INSERT INTO t1 VALUES (9,9);
|
SELECT TIME(a),TIME(b) FROM t1;
|
SHOW WARNINGS;
|
More related problems:
DROP TABLE IF EXISTS t1;
|
CREATE TABLE t1 (a BIGINT);
|
INSERT INTO t1 VALUES (-9223372036854775808);
|
SELECT CAST(a AS TIME), CAST(-9223372036854775808 AS TIME) FROM t1;
|
returns:
+-----------------+------------------------------------+
|
| CAST(a AS TIME) | CAST(-9223372036854775808 AS TIME) |
|
+-----------------+------------------------------------+
|
| NULL | -838:59:59 |
|
+-----------------+------------------------------------+
|
Notice, a field and a literal produce different results for the same value.
Attachments
Issue Links
- relates to
-
MDEV-8658 DATE(zerofill_column) and DATE(COALESCE(zerofill_column)) return different results
-
- Closed
-
Activity
Field | Original Value | New Value |
---|---|---|
Description |
{code} DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a BIGINT(15), b BIGINT(15) ZEROFILL); INSERT INTO t1 VALUES (9,9); SELECT TIME(a),TIME(b) FROM t1; SHOW WARNINGS; {code} returns {noformat} +----------+----------+ | TIME(a) | TIME(b) | +----------+----------+ | 00:00:09 | 00:00:00 | +----------+----------+ 1 row in set, 1 warning (0.00 sec) {noformat} with a warning: {noformat} +---------+------+---------------------------------------------------+ | Level | Code | Message | +---------+------+---------------------------------------------------+ | Warning | 1292 | Truncated incorrect time value: '000000000000009' | +---------+------+---------------------------------------------------+ {noformat} The expected behavior is to return '00:00:09' for both columns, with no warnings. |
{code} DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a BIGINT(15), b BIGINT(15) ZEROFILL); INSERT INTO t1 VALUES (9,9); SELECT TIME(a),TIME(b) FROM t1; SHOW WARNINGS; {code} returns {noformat} +----------+----------+ | TIME(a) | TIME(b) | +----------+----------+ | 00:00:09 | 00:00:00 | +----------+----------+ 1 row in set, 1 warning (0.00 sec) {noformat} with a warning: {noformat} +---------+------+---------------------------------------------------+ | Level | Code | Message | +---------+------+---------------------------------------------------+ | Warning | 1292 | Truncated incorrect time value: '000000000000009' | +---------+------+---------------------------------------------------+ {noformat} The expected behavior is to return '00:00:09' for both columns, with no warnings. The same problem is repeatable with the DECIMAL data type: {code} DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a DECIMAL(15,0), b DECIMAL(15,0) ZEROFILL); INSERT INTO t1 VALUES (9,9); SELECT TIME(a),TIME(b) FROM t1; SHOW WARNINGS; {code} |
Description |
{code} DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a BIGINT(15), b BIGINT(15) ZEROFILL); INSERT INTO t1 VALUES (9,9); SELECT TIME(a),TIME(b) FROM t1; SHOW WARNINGS; {code} returns {noformat} +----------+----------+ | TIME(a) | TIME(b) | +----------+----------+ | 00:00:09 | 00:00:00 | +----------+----------+ 1 row in set, 1 warning (0.00 sec) {noformat} with a warning: {noformat} +---------+------+---------------------------------------------------+ | Level | Code | Message | +---------+------+---------------------------------------------------+ | Warning | 1292 | Truncated incorrect time value: '000000000000009' | +---------+------+---------------------------------------------------+ {noformat} The expected behavior is to return '00:00:09' for both columns, with no warnings. The same problem is repeatable with the DECIMAL data type: {code} DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a DECIMAL(15,0), b DECIMAL(15,0) ZEROFILL); INSERT INTO t1 VALUES (9,9); SELECT TIME(a),TIME(b) FROM t1; SHOW WARNINGS; {code} |
{code} DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a BIGINT(15), b BIGINT(15) ZEROFILL); INSERT INTO t1 VALUES (9,9); SELECT TIME(a),TIME(b) FROM t1; SHOW WARNINGS; {code} returns {noformat} +----------+----------+ | TIME(a) | TIME(b) | +----------+----------+ | 00:00:09 | 00:00:00 | +----------+----------+ 1 row in set, 1 warning (0.00 sec) {noformat} with a warning: {noformat} +---------+------+---------------------------------------------------+ | Level | Code | Message | +---------+------+---------------------------------------------------+ | Warning | 1292 | Truncated incorrect time value: '000000000000009' | +---------+------+---------------------------------------------------+ {noformat} The expected behavior is to return '00:00:09' for both columns, with no warnings. The same problem is repeatable with the DECIMAL data type: {code} DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a DECIMAL(15,0), b DECIMAL(15,0) ZEROFILL); INSERT INTO t1 VALUES (9,9); SELECT TIME(a),TIME(b) FROM t1; SHOW WARNINGS; {code} More related problems: {code} DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a BIGINT); INSERT INTO t1 VALUES (-9223372036854775808); SELECT CAST(a AS TIME), CAST(-9223372036854775808 AS TIME) FROM t1; {code} returns: {noformat} +-----------------+------------------------------------+ | CAST(a AS TIME) | CAST(-9223372036854775808 AS TIME) | +-----------------+------------------------------------+ | NULL | -838:59:59 | +-----------------+------------------------------------+ {noformat} |
Description |
{code} DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a BIGINT(15), b BIGINT(15) ZEROFILL); INSERT INTO t1 VALUES (9,9); SELECT TIME(a),TIME(b) FROM t1; SHOW WARNINGS; {code} returns {noformat} +----------+----------+ | TIME(a) | TIME(b) | +----------+----------+ | 00:00:09 | 00:00:00 | +----------+----------+ 1 row in set, 1 warning (0.00 sec) {noformat} with a warning: {noformat} +---------+------+---------------------------------------------------+ | Level | Code | Message | +---------+------+---------------------------------------------------+ | Warning | 1292 | Truncated incorrect time value: '000000000000009' | +---------+------+---------------------------------------------------+ {noformat} The expected behavior is to return '00:00:09' for both columns, with no warnings. The same problem is repeatable with the DECIMAL data type: {code} DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a DECIMAL(15,0), b DECIMAL(15,0) ZEROFILL); INSERT INTO t1 VALUES (9,9); SELECT TIME(a),TIME(b) FROM t1; SHOW WARNINGS; {code} More related problems: {code} DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a BIGINT); INSERT INTO t1 VALUES (-9223372036854775808); SELECT CAST(a AS TIME), CAST(-9223372036854775808 AS TIME) FROM t1; {code} returns: {noformat} +-----------------+------------------------------------+ | CAST(a AS TIME) | CAST(-9223372036854775808 AS TIME) | +-----------------+------------------------------------+ | NULL | -838:59:59 | +-----------------+------------------------------------+ {noformat} |
{code} DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a BIGINT(15), b BIGINT(15) ZEROFILL); INSERT INTO t1 VALUES (9,9); SELECT TIME(a),TIME(b) FROM t1; SHOW WARNINGS; {code} returns {noformat} +----------+----------+ | TIME(a) | TIME(b) | +----------+----------+ | 00:00:09 | 00:00:00 | +----------+----------+ 1 row in set, 1 warning (0.00 sec) {noformat} with a warning: {noformat} +---------+------+---------------------------------------------------+ | Level | Code | Message | +---------+------+---------------------------------------------------+ | Warning | 1292 | Truncated incorrect time value: '000000000000009' | +---------+------+---------------------------------------------------+ {noformat} The expected behavior is to return '00:00:09' for both columns, with no warnings. The same problem is repeatable with the DECIMAL data type: {code} DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a DECIMAL(15,0), b DECIMAL(15,0) ZEROFILL); INSERT INTO t1 VALUES (9,9); SELECT TIME(a),TIME(b) FROM t1; SHOW WARNINGS; {code} More related problems: {code} DROP TABLE IF EXISTS t1; CREATE TABLE t1 (a BIGINT); INSERT INTO t1 VALUES (-9223372036854775808); SELECT CAST(a AS TIME), CAST(-9223372036854775808 AS TIME) FROM t1; {code} returns: {noformat} +-----------------+------------------------------------+ | CAST(a AS TIME) | CAST(-9223372036854775808 AS TIME) | +-----------------+------------------------------------+ | NULL | -838:59:59 | +-----------------+------------------------------------+ {noformat} Notice, a field and a literal produce different results for the same value. |
Rank | Ranked higher |
Rank | Ranked higher |
Rank | Ranked higher |
Sprint | 10.1.8-3 [ 15 ] |
Rank | Ranked lower |
Status | Open [ 1 ] | In Progress [ 3 ] |
Labels | upstream-not-affected |
Component/s | Temporal Types [ 11000 ] | |
Fix Version/s | 10.1.8 [ 19605 ] | |
Fix Version/s | 10.1 [ 16100 ] | |
Resolution | Fixed [ 1 ] | |
Status | In Progress [ 3 ] | Closed [ 6 ] |
Workflow | MariaDB v3 [ 71167 ] | MariaDB v4 [ 149500 ] |
Not repeatable in MySQL-5.7.8