Repository navigation
fix(parser): accept GRANT/REVOKE without object type (default TABLE) - #30875
Closed
MatrixAdventurer wants to merge 2 commits into
Closed
MatrixAdventurer wants to merge 2 commits into
MatrixAdventurer wants to merge 2 commits into
Conversation
MySQL accepts GRANT priv ON [TABLE] {*|*.*|db.*|db.tbl|tbl}; MO required
the object type keyword, so 'GRANT SELECT ON db.* TO u' was a syntax error.
Add GRANT/REVOKE alternatives without object_type that default to TABLE.
Fixes matrixorigin#30874
MatrixAdventurer
requested review from
XuPeng-SH and
iamlinjunhong
as code owners
October 22, 2026 15:55
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
…hout-table # Conflicts: # pkg/sql/parsers/dialect/mysql/mysql_sql.go
Contributor
Author
|
Merged current main into the branch (ac41291) to clear the conflict. Only
|
Contributor
|
相关issue将根据优先级计划修复 |
1 task done
This branch had an error being deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #30874
What this PR does / why we need it:
Cause.
grant_stmt/revoke_stmtinmysql_sql.yrequireobject_type(TABLE|DATABASE|...) afterON, so the MySQL short formGRANT SELECT ON db.* TO ufails with a 1064 syntax error. MySQL's grammar isON [TABLE|FUNCTION|PROCEDURE] priv_levelwith TABLE as the default.Fix. Add one GRANT and one REVOKE alternative without
object_typethat setObjType = OBJECT_TYPE_TABLE. The AST is identical to the explicitON TABLE ...form that already works, so privilege semantics don't change. goyacc reports no new conflicts.mysql_sql.gois regenerated (goyacc -o mysql_sql.go mysql_sql.y+ gofmt). Regenerating origin/main's.ywith the same command reproduces main's.goexactly, so the large.godiff is table renumbering only.Evidence.
grant_object_type_opt_test.go: on main, 7 short-form cases (db.*,db.tbl,tbl,*.*,*, REVOKE, REVOKE IF EXISTS) fail with a syntax error. With this PR all 10 cases pass, and each short form formats exactly like itson table ...counterpart. The explicit TABLE/DATABASE/ACCOUNT controls are unchanged.go test ./pkg/sql/parsers/...passes.Merge danger. Low. This is parser-only: two new grammar alternatives, and existing forms parse the same way.