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

grant lock tables on t.* to ${role_name} ERROR #27290

Closed
jingshanglu opened this issue Aug 17, 2021 · 4 comments · Fixed by #27489
Closed

grant lock tables on t.* to ${role_name} ERROR #27290

jingshanglu opened this issue Aug 17, 2021 · 4 comments · Fixed by #27489
Assignees
Labels
severity/minor sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.

Comments

@jingshanglu
Copy link
Contributor

Bug Report

Please answer these questions before submitting your issue. Thanks!

1. Minimal reproduce step (Required)

create database t;
drop role if exists r1;
create role r1;
grant lock tables on t.* TO 'r1'@'%';

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

grant successful

3. What did you see instead (Required)

ERROR 1221 (HY000): Incorrect usage of DB GRANT and NON-DB PRIVILEGES

4. What is your TiDB version? (Required)

master
commit id: caba86a

@jingshanglu jingshanglu added type/bug The issue is confirmed as a bug. severity/minor sig/sql-infra SIG: SQL Infra labels Aug 17, 2021
@jingshanglu jingshanglu self-assigned this Aug 17, 2021
@seiya-annie
Copy link

reproduce on 5.2.0.
5.1.1 seems don't have this bug.

@aytrack
Copy link
Contributor

aytrack commented Aug 18, 2021

5.1.1 not report this error but not really grant this privilege.

MySQL root@127.0.0.1:(none)> create database t;
                         ->  drop role if exists r1;
                         ->  create role r1;
                         ->  grant lock tables on t.* TO 'r1'@'%';
                         ->
Query OK, 0 rows affected
Time: 0.129s

Query OK, 0 rows affected
Time: 0.014s

Query OK, 0 rows affected
Time: 0.012s

Query OK, 0 rows affected
Time: 0.010s
MySQL root@127.0.0.1:(none)> show grants for 'r1'@'%';
+--------------------------------+
| Grants for r1@%                |
+--------------------------------+
| GRANT USAGE ON *.* TO 'r1'@'%' |
+--------------------------------+

1 row in set
Time: 0.005s
MySQL root@127.0.0.1:(none)> flush privileges;
Query OK, 0 rows affected
Time: 0.007s
MySQL root@127.0.0.1:(none)> show grants for 'r1'@'%';
+--------------------------------+
| Grants for r1@%                |
+--------------------------------+
| GRANT USAGE ON *.* TO 'r1'@'%' |
+--------------------------------+

1 row in set
Time: 0.007s
MySQL root@127.0.0.1:(none)>

@mjonss
Copy link
Contributor

mjonss commented Aug 18, 2021

Looks similar to #26703, maybe the same type of fix can be applied?

@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/minor sig/sql-infra SIG: SQL Infra type/bug The issue is confirmed as a bug.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants