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
GRANT role_list TO ...
This leads to 7 reduce/reduce conflicts, because:
We define
- object_privilege_list as:
object_privilege_list:
|
object_privilege
|
| object_privilege_list ',' object_privilege
|
- role_list as:
role_list:
|
grant_role
|
| role_list ',' grant_role
|
Within these two rules we allow for keywords such as EVENT, EXECUTE, FILE, PROCESS, RELOAD, SHUTDOWN.
Technically, the two grant statements should be unambigous:
GRANT EVENT, EXECUTE ON .....
|
GRANT EVENT, EXECUTE TO .....
|
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.
The decision would be clear, if the parser would look for the TO or ON keyword, but the lookahead token only looks forward one step.
Possible solutions:
Do not allow EVENT, EXECUTE, FILE, etc. as role names. (It will break people's existing databases on update).
Redefine both rules to account for this overlap. The downside to this approach is that it requires a pretty big amount of changes.
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
GRANT role_list TO ...
This leads to 7 reduce/reduce conflicts, because:
We define
object_privilege_list:
object_privilege
| object_privilege_list ',' object_privilege
role_list:
grant_role
| role_list ',' grant_role
Within these two rules we allow for keywords such as EVENT, EXECUTE, FILE, PROCESS, RELOAD, SHUTDOWN.
Technically, the two grant statements should be unambigous:
GRANT EVENT, EXECUTE ON .....
GRANT EVENT, EXECUTE TO .....
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.
The decision would be clear, if the parser would look for the TO or ON keyword, but the lookahead token only looks forward one step.
Possible solutions:
Do not allow EVENT, EXECUTE, FILE, etc. as role names. (It will break people's existing databases on update).
Redefine both rules to account for this overlap. The downside to this approach is that it requires a pretty big amount of changes.