Duplicate column names exist in `show grants` if current user set roles
- 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
-- root
use test;
CREATE USER u;
CREATE USER r1;
CREATE USER r2;
CREATE TABLE t (c1 int, c2 int);
GRANT select(c1, c2) ON test.t TO u;
GRANT select(c1, c2) ON test.t TO r1;
GRANT select(c1, c2) ON test.t TO r2;
GRANT r1 TO u;
GRANT r2 TO u;
SET DEFAULT ROLE ALL to u;
-- login as u
show grants;
```
### 2. What did you expect to see? (Required)
```sql
GRANT USAGE ON *.* TO 'u'@'%';
GRANT SELECT(c1, c2) ON `test`.`t` TO 'u'@'%';
GRANT 'r1'@'%', 'r2'@'%' TO 'u'@'%';
```
### 3. What did you see instead (Required)
```sql
GRANT USAGE ON *.* TO 'u'@'%';
GRANT SELECT(c1, c2, c1, c2, c1, c2) ON `test`.`t` TO 'u'@'%';
GRANT 'r1'@'%', 'r2'@'%' TO 'u'@'%';
```
### 4. What is your TiDB version? (Required)
master
Contributor guide
Assessment
This issue has not been assessed yet.