Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

show grants return wrong result. #27213

Closed
crazycs520 opened this issue Aug 13, 2021 · 2 comments · Fixed by #27218
Closed

show grants return wrong result. #27213

crazycs520 opened this issue Aug 13, 2021 · 2 comments · Fixed by #27218
Assignees
Labels
severity/moderate type/bug The issue is confirmed as a bug.

Comments

@crazycs520
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

Create user, role.

CREATE ROLE 'app_read';
create user test@'%';
GRANT SYSTEM_VARIABLES_ADMIN, PROCESS on *.* to 'app_read'@'%';
GRANT 'app_read' TO 'test'@'%';
SET DEFAULT ROLE app_read TO 'test'@'%';

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

▶ mysql -u test -h 127.0.0.1 -P 4000
(none)> show grants;
+---------------------------------------------------+
| Grants for test@%                                 |
+---------------------------------------------------+
| GRANT PROCESS ON *.* TO `test`@`%`                |
| GRANT SYSTEM_VARIABLES_ADMIN ON *.* TO `test`@`%` |
| GRANT `app_read`@`%` TO `test`@`%`                |
+---------------------------------------------------+
3 rows in set
Time: 0.008s
(none)> show grants for current_user();
+---------------------------------------------------+
| Grants for test@%                                 |
+---------------------------------------------------+
| GRANT PROCESS ON *.* TO `test`@`%`                |
| GRANT SYSTEM_VARIABLES_ADMIN ON *.* TO `test`@`%` |
| GRANT `app_read`@`%` TO `test`@`%`                |
+---------------------------------------------------+
3 rows in set

3. What did you see instead (Required)

▶ mysql -u test -h 127.0.0.1 -P 4000
(none)> show grants;
+------------------------------------+
| Grants for User                    |
+------------------------------------+
| GRANT PROCESS ON *.* TO 'test'@'%' |
| GRANT 'app_read'@'%' TO 'test'@'%' |
+------------------------------------+
2 rows in set
Time: 0.008s
(none)> show grants for current_user();
+------------------------------------+
| Grants for test@127.0.0.1          |
+------------------------------------+
| GRANT USAGE ON *.* TO 'test'@'%'   |
| GRANT 'app_read'@'%' TO 'test'@'%' |
+------------------------------------+

4. What is your TiDB version? (Required)

***************************[ 1. row ]***************************
tidb_version() | Release Version: v5.2.0-alpha-601-gce60af56e
Edition: Community
Git Commit Hash: ce60af56ea2bf28b72986dcb6e6e3300720186c8
Git Branch: master
UTC Build Time: 2021-08-13 10:53:04
GoVersion: go1.16.6
Race Enabled: false
TiKV Min Version: v3.0.0-60965b006877ca7234adaced7890d7b029ed1306
Check Table Before Drop: false
@crazycs520 crazycs520 added the type/bug The issue is confirmed as a bug. label Aug 13, 2021
@crazycs520
Copy link
Contributor Author

@morgo PTAL

@ti-srebot
Copy link
Contributor

Please edit this comment or add a new comment to complete the following information

Not a bug

  1. Remove the 'type/bug' label
  2. Add notes to indicate why it is not a bug

Duplicate bug

  1. Add the 'type/duplicate' label
  2. Add the link to the original bug

Bug

Note: Make Sure that 'component', and 'severity' labels are added
Example for how to fill out the template: #20100

1. Root Cause Analysis (RCA) (optional)

2. Symptom (optional)

3. All Trigger Conditions (optional)

4. Workaround (optional)

5. Affected versions

6. Fixed versions

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
severity/moderate type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants