Wrong privilege check when using DELETE with JOIN
- Dominant language
- Go
- Stars
- 40.5k
- Forks
- 6.2k
- PR merge metrics
- PR metrics pending
Description
## Bug Report
Please answer these questions before submitting your issue. Thanks!
### 1. Minimal reproduce step (Required)
```sql
create table test.tt1 (id bigint,pid bigint,name varchar(20),fullname varchar(20));
insert into test.tt1 values (1,null,'A',''),(2,1,'B',''),(3,2,'C','');
create database test2;
create table test2.tt2 (id bigint,pid bigint,name varchar(20),fullname varchar(20));
insert into test2.tt2 values (1,null,'A',''),(2,1,'B',''),(3,2,'C','');
create user u2;
GRANT USAGE ON *.* TO 'u2';
GRANT SELECT,INSERT,UPDATE,DELETE,CREATE,DROP,CREATE ROUTINE,ALTER ROUTINE,ALTER,EXECUTE,INDEX,CREATE VIEW,SHOW VIEW ON test.* TO 'u2';
// login as u2
delete test.tt1 from test.tt1 inner join test2.tt2 where tt1.id=test2.tt2.id;
```
### 2. What did you expect to see? (Required)
The last `delete` should fail due to the privilege of `test2`
### 3. What did you see instead (Required)
The last `delete` runs without error
### 4. What is your TiDB version? (Required)
The latest master, I believe it affects all released versions in the life cycle.
Contributor guide
Assessment
This issue has not been assessed yet.