pingcap/tidb

Tidb allow updates to a table when you are also using that same table in an inner select as your update criteria.

Open

#31,363 opened on Jan 5, 2022

View on GitHub
 (3 comments) (0 reactions) (1 assignee)Go (40,090 stars) (6,186 forks)batch import
affects-5.0affects-5.1affects-5.2affects-5.3affects-5.4affects-6.0good first issuehelp wantedseverity/minorsig/plannertype/bug

Description

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

drop table if exists t1;
CREATE TABLE t1 (x int);
INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));

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

mysql> INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
ERROR 1093 (HY000): You can't specify target table 't1' for update in FROM clause

3. What did you see instead (Required)

mysql> INSERT INTO t1 (x) VALUES ((SELECT x FROM t1));
Query OK, 1 row affected (0.00 sec)

4. What is your TiDB version? (Required)

| Release Version: v5.4.0-alpha-264-g6efa36df6
Edition: Community
Git Commit Hash: 6efa36df6cff325106f67ecfe3d79816ba37ca6a
Git Branch: master
UTC Build Time: 2021-12-28 02:03:55
GoVersion: go1.17.2
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false |

Contributor guide

Tidb allow updates to a table when you are also using that same table in an inner select as your update criteria. · pingcap/tidb#31363 | Good First Issue