Skip to content

some unexpected warning message when dealing with 0 ENUM #31569

@lance6716

Description

@lance6716

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

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions