Repository navigation
Description
Description
GRANT <priv> ON db.table TO ... — the bare object reference without the TABLE keyword, which is the standard MySQL spelling used by every permission-management tool — fails with a parser error on MatrixOne. The parser only accepts the object-type keyword form:
GRANT SELECT ON TABLE agx.m TO r1; -- OK (MO accepts)
GRANT SELECT ON agx.m TO r1; -- ERROR 1064: syntax error near " agx.m TO r1"
GRANT SELECT ON agx.* TO r1; -- 1064 (bare db.*)
GRANT SELECT ON *.* TO r1; -- 1064 near " *.* TO r1" ← even global level!
GRANT SELECT ON vw TO r1; -- 1064 (bare unqualified)MySQL 8.0 accepts all of these — object_type (TABLE|FUNCTION|PROCEDURE) is documented as optional in the GRANT grammar (GRANT priv ON [object_type] priv_level TO ...); the bare db.table, db.*, and *.* levels are the dominant spellings in the wild:
mysqldump --all-databasespermission re-import scripts- Ansible/Salt/Terraform privilege modules (default templates use bare forms)
- Liquibase/Flyway permission changelogs
- DBA runbooks (every MySQL tutorial teaches
GRANT SELECT ON mydb.* TO u)
Failure shape is a parser error, so none of the above degrade gracefully: the whole provisioning pipeline stops at line one. MO's own privilege model supports the semantics fine (with the keyword it works, including the object-type × privilege validity check — GRANT SELECT ON account * correctly rejects with "privilege select does not exist on object_type account"), so this is purely the grammar missing the optional-object_type form.
Also observed in the same session for completeness: the reciprocal REVOKE presumably shares the grammar shape (not independently verified in this report); the fix should cover both.
Impact
- MySQL-standard provisioning toolchains fail wholesale against MO at the first GRANT, with a confusing syntax error that reads like a typo rather than a dialect difference.
- Tutorials/StackOverflow-copy DBA flows fail verbatim, hurting time-to-first-success for new users.
Expected behavior
Parse GRANT <priv_list> ON <priv_level> TO ... with priv_level ∈ { *.*, db.*, db.table, table } and no object-type keyword (defaulting object_type to TABLE, per MySQL), plus the existing keyword forms. Same for REVOKE.
Reproduction
CREATE ROLE r1;
GRANT SELECT ON some_db.some_table TO r1; -- 1064 on MO, OK on MySQL 8
GRANT SELECT ON some_db.* TO r1; -- 1064
GRANT SELECT ON *.* TO r1; -- 1064Verified on main c6683bd2f5 (2026-10-30 locally built, fresh bootstrap), pymysql + mysql CLI (rule out client encoding).
Activity
Ariznawlll commentedon Nov 2, 2026
Retest on main@HEAD (c6683bd, built 2026-11-02): still present — all four bare forms still 1064:
GRANT ALL ON db.* TO u,GRANT SELECT ON db.tbl TO u,GRANT ALL ON *.* TO u,REVOKE ALL ON db.* FROM u. TheON TABLE ...keyword remains mandatory.fix(parser): support SERIAL columns and bare table grants (#32196)
XuPeng-SH commentedon Nov 5, 2026
QA 交接:GRANT/REVOKE 现可省略 TABLE,构造与显式 TABLE 相同的表权限 AST,覆盖 .、db.*、db.table 和未限定表名;保留原有权限级别、选项及授权拒绝。旧 c6683bd 上的 1064 复测早于本次修复,不当作新版本反例。
PR #32196 已于 2026-11-05 02:03:08 UTC 合入 main,merge SHA
80224b0314c6008ecb4de82d1e37b019d5e355df,最终 head5cfcb401ac173cbe1380abdf2b83b2afb51c53b5。完整 issue 和 PR 讨论未见当前适用的已验证反例或未完成开发 follow-up,可交 QA。验证证据与限制:
4311fe84d50a509b1b202e0eebf530289c4202b6:规范生成结果字节一致,既有 796 个 token 常量和 2,049 个 action body 保留;两个 parser 包及新增 16 个顶层测试通过。复审未新跑在线 SQL/BVT 或 planner/explain。建议 QA 将四类 bare 对象写法与显式 TABLE 对照,检查 GRANT 后的实际访问、REVOKE 后拒绝、合法选项和非授权用户拒绝,以及原 account 对象权限错误仍然保留。两条旧预期仅由语法拒绝改为支持,不应削弱授权检查。角色授权、proxy grant、WITH ADMIN OPTION 不属于本次改动范围。
交由 @Ariznawlll 继续验证。
slyunnn commentedon Nov 10, 2026
Regression and extended verification for #31804 (2026-11-10)
Verification Environment
origin/mainat test start,2f6fcc772175d0c0e80ad97aac6d44360c513347,fix(backup): verify empty provider-copied objects without EOF failure (#32434). Fresh Go1.27.1macOSarm64binary, verified native-library provenance and SQLgit_version()agreed.2 CN / 1 TN / 1 Log service / Proxy, with both CNs co-located in the launcher process. Proxy127.0.0.1:6001, CN1127.0.0.1:16001and CN2127.0.0.1:16002were connectable and each executed actual regression scenarios.COM_QUERYwith real restricted-user sessions, and JDBC BVT. The original global privilege-cache value was captured and restored.What Was Covered
db.table,db.*,*.*and unqualified table forms through every endpoint. Compared each with explicitON TABLEusing real grant, access and revoke operations on the same live user connection.WITH GRANT OPTION, actualINSERT/UPDATE, followed by explicit-form revoke and renewed access denial.SELECT ON ACCOUNT *rejection and immediateSELECT 1after denied operations. Error20101remained an authorization/privilege rejection.56/56and the broader permission-control BVT passed226/226statements per endpoint. All23selected parser test/subtest results passed normal/race. Both complete parser packages passed.Findings
Fix
80224b0314c6008ecb4de82d1e37b019d5e355df,fix(parser): support SERIAL columns and bare table grants, makes the object-type keyword optional while constructing the same table-privilege AST and retaining real authorization checks. Fix PR #32196The broad BVT's newly created tenant initially lacked the runner's default
testdatabase. Only that tenant's two session directives received an explicitinformation_schemadefault-database hint in a temporary fixture. System-user sessions kept their original default database, and the original SQL/golden assertions were preserved. This resolved the fixture failure.MOTR / BVT Coverage
Reused
grant_bare_object_test.go,tenant/privilege/bare_object_grant.sqlandzz_accesscontrol/grant_privs_role.sql, supplemented by all four live privilege levels and explicit/bare cross-revocation. No duplicate MOTR commit was needed. Verification is included in the weekly description. Weekly MOTR PR #321Permission validation ran serially because it changes a shared global cache setting and named authorization objects. The cache was restored, users/roles/databases were removed, and owned services were stopped.
Final Conclusion
Fixed on the tested main build.
Large-data regression is unnecessary. Grammar, privilege scope, actual access and connection-state behavior are directly covered by the small fixtures.