plan replayer can't handle views correctly if it's dumped and loaded by different users
- 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)
```sh
mysql -h 127.0.0.1 -P 4000 -u root
```
```sql
create user 'test1';
grant all privileges on test.* to 'test1';
```
```sh
mysql -h 127.0.0.1 -P 4000 -u test1
```
```sql
use test;
create table t(a int, b int);
create view v1 as select a from t;
plan replayer dump explain select * from v1;
```
Start a new tidb cluster.
```sh
mysql -h 127.0.0.1 -P 4000 -u root
```
```sql
plan replayer load 'xxx';
explain select * from v1;
```
### 2. What did you expect to see? (Required)
The execution plan is displayed.
### 3. What did you see instead (Required)
```
> explain select * from v1;
ERROR 1356 (HY000): View 'test.v1' references invalid table(s) or column(s) or function(s) or definer/invoker of view lack rights to use them
```
### 4. What is your TiDB version? (Required)
master (v9.0.0)
Contributor guide
Assessment
This issue has not been assessed yet.