[MDEV-5772] Granting multiple roles in single statement does not work Created: 2014-03-01 Updated: 2022-01-18 |
|
| Status: | Open |
| Project: | MariaDB Server |
| Component/s: | None |
| Affects Version/s: | 10.0.8 |
| Fix Version/s: | 10.1 |
| Type: | Bug | Priority: | Minor |
| Reporter: | Elena Stepanova | Assignee: | Vicențiu Ciorbaru |
| Resolution: | Unresolved | Votes: | 0 |
| Labels: | None | ||
| Issue Links: |
|
||||||||||||||||
| Description |
|
One can create several roles at once:
One can grant multiple privileges to multiple users at once:
But one cannot grant multiple roles at once:
SQL standard seems to think that it should work. |
| Comments |
| Comment by Vicențiu Ciorbaru [ 2015-03-02 ] | ||||||||
|
I've started working on this and I'm somewhat stuck at the moment with the following grammar extension issue: I've redefined GRANT grant_role TO .... to We define
Within these two rules we allow for keywords such as EVENT, EXECUTE, FILE, PROCESS, RELOAD, SHUTDOWN. Technically, the two grant statements should be unambigous:
These 2 statements are different. The first one refers to object privileges, while the other one refers to role grants. Bison finds these to be ambiguous because it needs to make a decision on which rule (object_privilege_list or role_list) to use, when it encounters the ',' (comma) token. Possible solutions: | ||||||||
| Comment by Sergei Golubchik [ 2015-03-02 ] | ||||||||
|
I wouldn't like the first solution. The second is straightforward, but requires a notable amount of changes. Like, create one rule that accepts a list of identifiers or privileges. Create a structure that can accumulate that list and at the end — when you see ON or TO — decide how to parse it. There are details, like having a column list forces the structure to be interpreted as a list of privileges, etc. One would need to remember positions in the list for every word t be able to do correct error messages. All in all not while not complex, but still a big change. Taking into account that this is a minor task, I'd postpone it. | ||||||||
| Comment by Vicențiu Ciorbaru [ 2015-03-02 ] | ||||||||
|
I agree that the first option is rather undesirable. I thought that there might be a simpler implementation but I guess there isn't one. I'll keep it as a back burner. |