Skip to content

ERROR 1109 when create global binding for delete statement with subquery #56726

@harry1129

Description

@harry1129

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

mysql> use test;
Database changed
mysql> create table t1(id int);
Query OK, 0 rows affected (0.09 sec)

mysql> create table t2(id int);
Query OK, 0 rows affected (0.10 sec)

mysql> delete tt1 from t1 tt1,(select max(id) id from t2)tt2 where tt1.id<=tt2.id;
Query OK, 0 rows affected (0.00 sec)

mysql> 
mysql> create global binding for
    -> delete tt1 from t1 tt1,(select max(id) id from t2)tt2 where tt1.id<=tt2.id
    -> using
    -> delete /*+ MAX_EXECUTION_TIME(10)*/ tt1 from t1 tt1,(select max(id) id from t2)tt2 where tt1.id<=tt2.id;
ERROR 1109 (42S02): Unknown table 'tt1' in MULTI DELETE
mysql> 

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

NO ERROR

3. What did you see instead (Required)

ERROR 1109

4. What is your TiDB version? (Required)

mysql> select tidb_version()\G
*************************** 1. row ***************************
tidb_version(): Release Version: v6.5.11
Edition: Community
Git Commit Hash: 3f2073261bf9f454c3c677d76d120c6ab40ca05c
Git Branch: HEAD
UTC Build Time: 2024-09-18 04:07:03
GoVersion: go1.19.13
Race Enabled: false
TiKV Min Version: 6.2.0-alpha
Check Table Before Drop: false
Store: tikv
1 row in set (0.00 sec)

Metadata

Metadata

Assignees

Labels

affects-6.5This bug affects the 6.5.x(LTS) versions.affects-7.1This bug affects the 7.1.x(LTS) versions.affects-7.5This bug affects the 7.5.x(LTS) versions.affects-8.1This bug affects the 8.1.x(LTS) versions.affects-8.5This bug affects the 8.5.x(LTS) versions.severity/majorsig/plannerSIG: Plannertype/bugThe issue is confirmed as a bug.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions