Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

runtime error shown in warning instead of truncate #48756

Closed
mjonss opened this issue Nov 21, 2023 · 0 comments · Fixed by #54043
Closed

runtime error shown in warning instead of truncate #48756

mjonss opened this issue Nov 21, 2023 · 0 comments · Fixed by #54043
Assignees
Labels

Comments

@mjonss
Copy link
Contributor

mjonss commented Nov 21, 2023

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
@mjonss mjonss added the type/bug The issue is confirmed as a bug. label Nov 21, 2023
@ti-chi-bot ti-chi-bot bot added may-affects-5.3 This bug maybe affects 5.3.x versions. may-affects-5.4 This bug maybe affects 5.4.x versions. may-affects-6.1 may-affects-6.5 may-affects-7.1 may-affects-7.5 labels Nov 22, 2023
@xhebox xhebox self-assigned this Nov 24, 2023
@xhebox xhebox removed the may-affects-5.3 This bug maybe affects 5.3.x versions. label Jun 17, 2024
ti-chi-bot bot pushed a commit that referenced this issue Jul 1, 2024
ti-chi-bot bot pushed a commit that referenced this issue Jul 2, 2024
ti-chi-bot bot pushed a commit that referenced this issue Jul 2, 2024
ti-chi-bot bot pushed a commit that referenced this issue Jul 2, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants