tidb-challenge-program / bug-hunting-issue

Bug hunting issues.
3 stars 0 forks source link

P2-[4.0 bug hunting]-[SQL Plan Management]-Unexpected error "Data Too Long" when using a WHERE clause in an UPDATE #43

Open mrigger opened 4 years ago

mrigger commented 4 years ago

Consider the following statements:

CREATE TABLE t0(c0 DOUBLE);
INSERT INTO t0 VALUES (1e30);
UPDATE t0 SET c0=0 WHERE t0.c0 LIKE 0; -- Data Too Long, field len 22, data len 31

Unexpectedly, the UPDATE results in an error. When omitting the WHERE clause, the UPDATE works as expected:

Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 1
Server version: 5.7.25-TiDB- TiDB Server (Apache License 2.0), MySQL 5.7 compatible

Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> CREATE TABLE t0(c0 DOUBLE);
Query OK, 0 rows affected (0.00 sec)

mysql> INSERT INTO t0 VALUES (1e30);
Query OK, 1 row affected (0.00 sec)

mysql> UPDATE t0 SET c0=0 WHERE t0.c0 LIKE 0;
ERROR 1105 (HY000): Data Too Long, field len 22, data len 31
mysql> UPDATE t0 SET c0=0;
Query OK, 1 row affected (0.00 sec)
Rows matched: 1  Changed: 1  Warnings: 0

When using MySQL 8.0.19, this seems to work as expected, without an error.

shuke987 commented 4 years ago

/bug P1