Skip to content

[Bug]: SHOW GRANTS renders granted object as literal 'd.t' #32446

Closed

Description

@Ariznawlll

Existing issue search:

  • I have searched existing issues to avoid duplicates

Branch Name: main

Commit ID: e2459cc55f4b514893e19732743460bc5f16d552 (2026-11-09)

Environment: Local single-node launch (CN + TN + LogService in one process tree), macOS arm64, freshly compiled from current main, clean catalog.

Actual Behavior:

SHOW GRANTS FOR ROLE <role> (and SHOW GRANTS FOR <user>) renders the granted object as the literal placeholder d.t instead of the actual database.table:

mysql> SHOW GRANTS FOR ROLE r_showv;
+-------------------------------------+
| Grants for r_showv                  |
+-------------------------------------+
| GRANT select ON table d.t `r_showv` |
+-------------------------------------+

The storage layer is correct — joining mo_catalog.mo_role_privs.obj_id against mo_catalog.mo_tables.rel_id resolves the true object (bh1 / t). So this is purely a rendering defect in the SHOW GRANTS output construction.

Impact: Privilege auditing is blind — from the SHOW GRANTS output alone, an auditor cannot tell which table (or database) a grant applies to. For accounts with many table-level grants the output is useless for review, and any tooling parsing SHOW GRANTS cannot determine the object.

Expected Behavior:

SHOW GRANTS FOR ROLE r should render the actual qualified object name, e.g.:

GRANT select ON table bh1.t TO `r_showv`

as MySQL does (GRANT SELECT ON bh1.t TO ...).

Steps to Reproduce:

-- 1. Grant some privilege on a real table
CREATE DATABASE bh1;
CREATE TABLE bh1.t (id INT PRIMARY KEY);
CREATE ROLE r_showv;
GRANT SELECT ON TABLE bh1.t TO r_showv;

-- 2. Render the grant
SHOW GRANTS FOR ROLE r_showv;
-- → GRANT select ON table d.t `r_showv`     ❌ object shown as literal "d.t"

-- 3. Prove the storage is correct (as root)
SELECT rt.reldatabase, rt.relname
FROM mo_catalog.mo_role_privs rp
JOIN mo_catalog.mo_role r ON rp.role_id = r.role_id
LEFT JOIN mo_catalog.mo_tables rt ON rp.obj_id = rt.rel_id
WHERE r.role_name = 'r_showv';
-- → reldatabase='bh1', relname='t'           ✓ stored fine; only display is wrong

Severity: Diagnosability/audit — no data corruption, but SHOW GRANTS is the primary tool for reviewing what was granted; with d.t placeholders the review is impossible. Low-risk fix (string construction in the SHOW GRANTS response path).

Cross-reference: Verified at least 3 times on 2026-11-09/10 against current main e2459cc55f. Also reproduced for user grants (SHOW GRANTS FOR u_test). Possibly shares a root cause with the view-grant enforcement defect (view grants also render as d.t).

Activity

  1. added
    kind/bug
    on Nov 10, 2026
  2. added theissue type on Nov 10, 2026
  3. added this to the MO-202611 milestone on Nov 10, 2026
  4. added
    severity/s2
    and removed
    severity/s2
    on Nov 10, 2026
  5. changed the title [-][Bug]: SHOW GRANTS renders granted objects as literal placeholder "d.t" instead of actual database.table[/-] [+][Bug]: SHOW GRANTS renders granted object as literal 'd.t'[/+] on Nov 11, 2026
  6. added a commit that references this issue on Nov 13, 2026
    2573b28
  7. XuPeng-SH commented on Nov 13, 2026

    @XuPeng-SH
    Contributor

    QA handoff (main, not acceptance)

    Merged fix: #32649, main merge SHA 2573b2895bb73af99c95960c2f5595edde7b62b1 (reviewed PR head fb85c8024e5401e6a627ff2e6fda1d4ab71aa85a). SHOW GRANTS now resolves actual relation/database names from current-account catalog identities, including logical relation IDs, instead of printing the d.t token. Role/user membership and global or unresolved-object fallback remain unchanged; output is stably ordered and resolved identifiers are quoted.

    Evidence reviewed: merged scope-resolution changes and committed planner/BVT regressions; author-reported seven directed SHOW GRANTS expected/actual groups and six canonical BVT scripts (992 successful, 18 existing-issue skips, 0 failed/abnormal); the same-head review reports 9 focused frontend/planner roots / 16 executions passing without skips. These are remote author/reviewer reports, not this run's local tests. Raw per-case artifacts were not independently checked here, and a fresh main server/BVT run was not performed.

    Complete issue/PR discussion contains no current applicable verified counterexample or unfinished development follow-up. Handing to @Ariznawlll for QA, keeping the issue open pending acceptance. Suggested boundaries: SHOW GRANTS for roles and users; table/view exact scopes, database scopes and db-bound wildcards; same-name objects across accounts; quoted identifiers; logical identity after supported table changes; unchanged global/unresolved fallback and role membership. This is a rendering fix, not a claim of new direct-user object-grant or column-authorization semantics. No 4.2 backport is requested by this handoff.

  8. slyunnn commented on Nov 16, 2026

    @slyunnn

    Regression and extended verification for #32446 (2026-11-16)

    Verification Environment

    Latest fetched origin/main 4349e7321825639c0f9001e4271df278127060cf — perf(objectio): compress directly into available writer arena (#32774). Native 2 CN / 1 TN / 1 Log service / Proxy; Proxy 6001, CN1 16001, CN2 16002 were connected and each ran the regression. The binary and git_version() matched the checkout. MySQL protocol via PyMySQL; serial MOTR -j 1.

    What Was Covered

    • OK — Original reproduction and role/user grants; exact tables and views, wildcard and database scopes, quoted names, rename, dropped objects and same-name cross-account isolation.
    • OK — MOTR recording and replay passed with no skipped cases, including separate replays through all three endpoints.
    • Not covered — Unresolved-object fallback and production account datasets were not directly exercised. 4.2-dev and released-server compatibility were not tested.

    Findings

    Fix PR #32649 — fix(sql): reject column privileges and render granted object scopes — merged as 2573b2895bb73af99c95960c2f5595edde7b62b1 and is in the verified main history. Large-data regression is unnecessary: the issue concerns catalog identity rendering rather than data scale or parallel execution.

    MOTR / BVT Coverage

    Source commit 835ef240442c39fe3b5bdf69d008cc5f12521785 was recorded, replayed and pushed; daily cherry-pick 242fde750ed7b1dba7050821b97c584b054b22d2 is in MOTR PR #347.

    Final Conclusion

    Fixed on the verified main commit.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

area/frontendkind/bug

Type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions