-
Notifications
You must be signed in to change notification settings - Fork 5.8k
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
Confusing behavior in the UPDATE statement #31708
Comments
I can't reproduce against master: tidb> DROP TABLE IF EXISTS t0;
Query OK, 0 rows affected (0.01 sec)
tidb> CREATE TABLE t0(c0 INT);
Query OK, 0 rows affected (0.00 sec)
tidb> INSERT INTO t0 VALUES(0);
Query OK, 1 row affected (0.00 sec)
tidb> UPDATE t0 SET c0 = 1 WHERE 0^('0.5');
ERROR 1292 (22007): Truncated incorrect INTEGER value: '0.5'
tidb> SELECT tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v5.5.0-alpha-26-ge249588f5-dirty
Edition: Community
Git Commit Hash: e249588f5bca9424aaa6b37a1f2c523cf97eb9d0
Git Branch: experimental-instance-vars
UTC Build Time: 2022-01-14 17:33:34
GoVersion: go1.16.9
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
1 row in set (0.00 sec) It looks like this might be a duplicate of a bug that has been fixed. |
I was mistaken, it can be reproduced against master. However, this can only be reproduced when using TiKV. against unistore there is an error and the |
Confirming that this expression is executed in the coprocessor: tidb> explain UPDATE t0 SET c0 = 1 WHERE 0^('0.3');
+---------------------------+----------+-----------+---------------+------------------------------------------+
| id | estRows | task | access object | operator info |
+---------------------------+----------+-----------+---------------+------------------------------------------+
| Update_4 | N/A | root | | N/A |
| └─TableReader_8 | 8000.00 | root | | data:Selection_7 |
| └─Selection_7 | 8000.00 | cop[tikv] | | bitxor(0, cast("0.3", bigint(3) BINARY)) |
| └─TableFullScan_6 | 10000.00 | cop[tikv] | table:t0 | keep order:false, stats:pseudo |
+---------------------------+----------+-----------+---------------+------------------------------------------+
4 rows in set (0.00 sec)
tidb> explain UPDATE t0 SET c0 = 1 WHERE 0^('0.5');
+---------------------------+----------+-----------+---------------+------------------------------------------+
| id | estRows | task | access object | operator info |
+---------------------------+----------+-----------+---------------+------------------------------------------+
| Update_4 | N/A | root | | N/A |
| └─TableReader_8 | 8000.00 | root | | data:Selection_7 |
| └─Selection_7 | 8000.00 | cop[tikv] | | bitxor(0, cast("0.5", bigint(3) BINARY)) |
| └─TableFullScan_6 | 10000.00 | cop[tikv] | table:t0 | keep order:false, stats:pseudo |
+---------------------------+----------+-----------+---------------+------------------------------------------+
4 rows in set (0.00 sec) There are technically 2 bugs:
mysql [localhost:8027] {msandbox} (test) > insert into t2 VALUES (cast("1.0" as unsigned));
ERROR 1292 (22007): Truncated incorrect INTEGER value: '1.0'
mysql [localhost:8027] {msandbox} (test) > insert into t2 VALUES (cast("1" as unsigned));
Query OK, 1 row affected (0.00 sec) For (2) tidb gets this right with unistore, but not with tikv. |
I try the same where clause in the DELETE statement as follows: DROP TABLE IF EXISTS t0;
CREATE TABLE t0 (c0 INT);
INSERT INTO t0 VALUES (1);
DELETE FROM t0 WHERE 0^('0.5'); The DELETE statement also succeeded. I want to know whether the same reason as UPDATE cause this problem. Thanks! |
They are 90% for the same reason. |
Will fix in tikv/tikv#13045 |
tikv/tikv#13046 merged |
Bug Report
Please answer these questions before submitting your issue. Thanks!
1. Minimal reproduce step (Required)
2. What did you expect to see? (Required)
The column c0 should not be updated, as the result of 0^('0.5') is 0.
3. What did you see instead (Required)
4. What is your TiDB version? (Required)
mysql> SELECT tidb_version();
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| tidb_version() |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| Release Version: v5.3.0
Edition: Community
Git Commit Hash: 4a1b2e9
Git Branch: heads/refs/tags/v5.3.0
UTC Build Time: 2021-11-24 13:32:39
GoVersion: go1.16.4
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |
+----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.00 sec)
mysql>
The text was updated successfully, but these errors were encountered: