-
Notifications
You must be signed in to change notification settings - Fork 6k
Closed
Labels
affects-5.4This bug affects the 5.4.x(LTS) versions.This bug affects the 5.4.x(LTS) versions.affects-6.1This bug affects the 6.1.x(LTS) versions.This bug affects the 6.1.x(LTS) versions.affects-6.5This bug affects the 6.5.x(LTS) versions.This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.This bug affects the 8.1.x(LTS) versions.severity/majorsig/sql-infraSIG: SQL InfraSIG: SQL Infratype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.
Description
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
CREATE TABLE t (id INT, a VARBINARY(20), b BIGINT);
INSERT INTO t VALUES(1, _binary '2012-05-19 09:06:07', 20120519090607),
(1, _binary '2012-05-19 09:06:07', 20120519090607),
(2, _binary '12012-05-19 09:06:07', 120120519090607),
(2, _binary '12012-05-19 09:06:07', 120120519090607);
SELECT SUBTIME(BIT_OR(b), '1 1:1:1.000002') FROM t GROUP BY id;
show warnings;
2. What did you expect to see? (Required)
Truncate warning
mysql> CREATE TABLE t (id INT, a VARBINARY(20), b BIGINT);
Query OK, 0 rows affected (0,02 sec)
mysql> INSERT INTO t VALUES(1, _binary '2012-05-19 09:06:07', 20120519090607),
-> (1, _binary '2012-05-19 09:06:07', 20120519090607),
-> (2, _binary '12012-05-19 09:06:07', 120120519090607),
-> (2, _binary '12012-05-19 09:06:07', 120120519090607);
Query OK, 4 rows affected (0,00 sec)
Records: 4 Duplicates: 0 Warnings: 0
mysql> SELECT SUBTIME(BIT_OR(b), '1 1:1:1.000002') FROM t GROUP BY id;
+--------------------------------------+
| SUBTIME(BIT_OR(b), '1 1:1:1.000002') |
+--------------------------------------+
| 2012-05-18 08:05:05.999998 |
| NULL |
+--------------------------------------+
2 rows in set, 1 warning (0,00 sec)
mysql> show warnings;
+---------+------+---------------------------------------------------+
| Level | Code | Message |
+---------+------+---------------------------------------------------+
| Warning | 1292 | Truncated incorrect time value: '120120519090607' |
+---------+------+---------------------------------------------------+
1 row in set (0,00 sec)
3. What did you see instead (Required)
ERROR 1105 (HY000): runtime error: invalid memory address or nil pointer dereference
tidb> CREATE TABLE t (id INT, a VARBINARY(20), b BIGINT);
Query OK, 0 rows affected (0.08 sec)
tidb> INSERT INTO t VALUES(1, _binary '2012-05-19 09:06:07', 20120519090607),
-> (1, _binary '2012-05-19 09:06:07', 20120519090607),
-> (2, _binary '12012-05-19 09:06:07', 120120519090607),
-> (2, _binary '12012-05-19 09:06:07', 120120519090607);
Query OK, 4 rows affected (0.01 sec)
Records: 4 Duplicates: 0 Warnings: 0
tidb> SELECT SUBTIME(BIT_OR(b), '1 1:1:1.000002') FROM t GROUP BY id;
+--------------------------------------+
| SUBTIME(BIT_OR(b), '1 1:1:1.000002') |
+--------------------------------------+
| NULL |
| 2012-05-18 08:05:05.999998 |
+--------------------------------------+
2 rows in set, 2 warnings (0.00 sec)
tidb> show warnings;
ERROR 1105 (HY000): runtime error: invalid memory address or nil pointer dereference
tidb>
4. What is your TiDB version? (Required)
tidb_version(): Release Version: v7.6.0-alpha
Edition: Community
Git Commit Hash: 058a9614b22b42e1a93546e1f0e7ee1aae1ceb05
Git Branch: heads/refs/tags/v7.6.0-alpha
UTC Build Time: 2023-11-21 14:29:14
GoVersion: go1.21.3
Race Enabled: false
Check Table Before Drop: false
Store: tikv
Metadata
Metadata
Assignees
Labels
affects-5.4This bug affects the 5.4.x(LTS) versions.This bug affects the 5.4.x(LTS) versions.affects-6.1This bug affects the 6.1.x(LTS) versions.This bug affects the 6.1.x(LTS) versions.affects-6.5This bug affects the 6.5.x(LTS) versions.This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.This bug affects the 8.1.x(LTS) versions.severity/majorsig/sql-infraSIG: SQL InfraSIG: SQL Infratype/bugThe issue is confirmed as a bug.The issue is confirmed as a bug.