Skip to content

GRANT SELECT ON db.* is rejected without the optional TABLE keyword #30874

Done

Description

@XuPeng-SH

Summary

GRANT ... ON <db>.* TO <user> is rejected; the object type keyword TABLE is mandatory. MySQL accepts the form without it.

Repro (main@3ad9adbb4c)

create user if not exists qa_u1 identified by 'Pwd123!@#';
grant select on qa2.* to qa_u1;
-- ERROR 1064 (42000): SQL parser error ... syntax error at line 1 column 19 near " qa2.* to qa_u1"

grant select on table qa2.* to qa_u1;   -- accepted

Expected

MySQL 8.0 grammar is GRANT priv ON [TABLE|FUNCTION|PROCEDURE] {tbl_name|*|*.*|db.*} TO user — the object type is optional, so GRANT SELECT ON db.* must parse. Tooling and ORMs commonly emit the short form for schema-level grants, so this breaks scripts that work on MySQL.

Reproduced identically on window base 7b911aea68 — pre-existing compatibility gap, not a regression from the last 100 commits.

Activity

  1. added
    kind/bug
    on Oct 22, 2026
  2. XuPeng-SH commented on Oct 22, 2026

    @XuPeng-SH
    ContributorAuthor

    Tracking note: the fix for this issue is PR #30875 (fix(parser): accept GRANT/REVOKE without object type (default TABLE)), which is not merged yet:

    PR #30875 现状
    state OPEN, not draft
    mergeable CONFLICTING / mergeState=DIRTY(与 main 有冲突,需要 rebase)
    review REVIEW_REQUIRED(无批准)
    checks 各 job 均为 skipping,等于没有有效 CI 结果
    diff 3 files, +13580/−13426(含生成的 parser 代码,需确认改动面只在 mysql_sql.y 与生成物)

    因此本 issue 保持 OPEN,不转 QA:main@3ad9adbb4c 上仍可复现(GRANT SELECT ON db.* → 1064),QA 没有可验证的合入点。

    按流程把本 issue 交给该修复 PR 的作者跟进(单一 assignee),等 #30875 解决冲突、拿到 review 与有效 CI 并合入 main 后,我再在本地按原始复现做验收,通过才会转测。

    复现(供 rebase 后自测):

    create user if not exists qa_u1 identified by 'Pwd123!@#';
    grant select on qa2.* to qa_u1;          -- 期望成功;当前 1064 near " qa2.* to qa_u1"
    grant select on table qa2.* to qa_u1;    -- 现状可用的绕行写法
  3. MatrixAdventurer commented on Oct 26, 2026

    @MatrixAdventurer
    Contributor

    Status update: #30875 currently conflicts with main. It is being updated against current main (merging main and regenerating the parser), after which CI will be re-run and review re-requested. I will post here once that is done.

    本操作由 LW 授权的 Grok Bot 智能体执行。

  4. MatrixAdventurer commented on Nov 20, 2026

    @MatrixAdventurer
    Contributor

    🤖 Agent | ChatGPT | ChatGPT

    2026-11-20 整理结论:此前进度称 #30875 正在解决冲突;现核对其已关闭且未合并,不能据此认定 GRANT 可选 TABLE 语法已修复。本单保留开放,需要新的有效修复 PR 与解析器回归证据。

    由LW授权的ChatGPT Business智能体提交。

  5. XuPeng-SH commented on Nov 29, 2026

    @XuPeng-SH
    ContributorAuthor

    Closing as duplicate of #30626, item A.

    Both reports cover the MySQL-compatible GRANT <privileges> ON db.* ... form being rejected unless the optional TABLE keyword is supplied. The SELECT ON db.* reproduction, explicit-TABLE control, and unmerged #30875 status are retained on #30626.

    Administrative consolidation only; this does not mean the parser gap is fixed or QA-verified.

  6. added
    duplicate
    on Nov 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

duplicatekind/bugneeds-triage

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions