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

some unexpected warning message when dealing with 0 ENUM #31569

Closed
lance6716 opened this issue Jan 11, 2022 · 1 comment · Fixed by #36304
Closed

some unexpected warning message when dealing with 0 ENUM #31569

lance6716 opened this issue Jan 11, 2022 · 1 comment · Fixed by #36304
Labels
affects-5.4 This bug affects 5.4.x versions. affects-6.0 affects-6.1 affects-6.2 severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.

Comments

@lance6716
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

MySQL [(none)]> use test
Database changed
MySQL [test]> create table t100 (c int primary key, c2 enum('a', 'b'));
Query OK, 0 rows affected (0.010 sec)

MySQL [test]> set session sql_mode = '';
Query OK, 0 rows affected (0.001 sec)

MySQL [test]> insert into t100 values(5, 0);
Query OK, 1 row affected, 1 warning (0.001 sec)

MySQL [test]> insert into t100 values(4, 'a');
Query OK, 1 row affected (0.002 sec)

MySQL [test]> insert into t100 values(4, 0) on duplicate key update c=values(c), c2=values(c2);
Query OK, 2 rows affected, 2 warnings (0.003 sec)

MySQL [test]> show warnings;
+---------+------+------------------------------------------+
| Level   | Code | Message                                  |
+---------+------+------------------------------------------+
| Warning | 1265 | Data truncated for column '%s' at row %d |
| Warning | 1265 | Data truncated for column '%s' at row %d |
+---------+------+------------------------------------------+
2 rows in set (0.001 sec)

MySQL [test]> select * from t100;
+---+------+
| c | c2   |
+---+------+
| 4 |      |
| 5 |      |
+---+------+
2 rows in set (0.007 sec)

MySQL [test]> insert into t100 values(4, 'a') on duplicate key update c=values(c), c2=values(c2);
Query OK, 2 rows affected, 1 warning (0.002 sec)

MySQL [test]> show warnings;
ERROR 1105 (HY000): runtime error: invalid memory address or nil pointer dereference
MySQL [test]> select * from t100;
+---+------+
| c | c2   |
+---+------+
| 4 | a    |
| 5 |      |
+---+------+
2 rows in set (0.007 sec)

MySQL [test]> 

2. What did you expect to see? (Required)

message is normal

3. What did you see instead (Required)

Data truncated for column '%s' at row %d

ERROR 1105 (HY000): runtime error: invalid memory address or nil pointer dereference

4. What is your TiDB version? (Required)

Release Version: v5.4.0-alpha-573-g0943e10d5
Edition: Community
Git Commit Hash: 0943e10d50c814efc72231f0c7d59204b69773fd
Git Branch: master
UTC Build Time: 2021-12-31 02:18:26
GoVersion: go1.17.5
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
@lance6716 lance6716 added the type/bug The issue is confirmed as a bug. label Jan 11, 2022
@jebter jebter added the affects-5.4 This bug affects 5.4.x versions. label Jan 11, 2022
@zanmato1984 zanmato1984 added sig/transaction SIG:Transaction and removed sig/execution SIG execution labels May 16, 2022
@zanmato1984
Copy link
Contributor

This seems to be related to on duplicate key. Handling to txn sig.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
affects-5.4 This bug affects 5.4.x versions. affects-6.0 affects-6.1 affects-6.2 severity/major sig/execution SIG execution type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants