Skip to content

fix(mysql): support SHOW GRANTS FOR CURRENT_USER - #29993

Merged
XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
daviszhen:codex/fix-29952-show-grants
Oct 12, 2026
Merged

XuPeng-SH merged 2 commits into
matrixorigin:mainfrom
daviszhen:codex/fix-29952-show-grants

Conversation

@daviszhen

Copy link
Copy Markdown
Contributor

What type of PR is this?

  • API-change
  • BUG
  • Improvement
  • Documentation
  • Feature
  • Test and CI
  • Code Refactoring

Which issue(s) this PR fixes:

issue #29952

What this PR does / why we need it:

Accept both SHOW GRANTS FOR CURRENT_USER and SHOW GRANTS FOR CURRENT_USER(). The parser records the current-user form, and the existing plan builder resolves it to the authenticated session identity. Added parser and plan regressions.

@qodo-code-review

Copy link
Copy Markdown

Qodo reviews are paused for this user.

Troubleshooting steps vary by plan Learn more →

On a Teams plan?
Reviews resume once this user has a paid seat and their Git account is linked in Qodo.
Link Git account →

Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center?
These require an Enterprise plan - Contact us
Contact us →

@daviszhen

Copy link
Copy Markdown
Contributor Author

Reviewed head 5c5759ad0f43e79c31977578fcba8bb6efe59187 and its PR-specific diff against base 7af631bdf79e7beb4bb3588e2bfd03ba4852b6cc.

Recommendation: approve from the code-review perspective, subject to required CI passing. No confirmed blocker in this syntax compatibility fix.

The new production accepts both CURRENT_USER forms, retains the AST distinction through CurrentUser, and formats them canonically. Leaving Username/Hostname empty reuses the existing current-session username/default-host resolution in buildShowGrants; explicit-user and role syntax are not replaced. The generated parser action agrees with the grammar addition.

Independent exact-head validation with linked CGo:

  • Targeted ShowGrants parser/planner tests passed.
  • A temporary embedded SQL test on an authenticated dump connection compared SHOW GRANTS, SHOW GRANTS FOR CURRENT_USER, SHOW GRANTS FOR CURRENT_USER() and SHOW GRANTS FOR 'dump'@'localhost'. All returned the same nonempty grant multiset.
  • Full PR git diff --check passed. No product code was modified.

Non-blocking test improvement: the added planner cases only log errors from the incomplete mock catalog, so they would also pass if planning failed for an unintended reason. Add a durable successful execution assertion like the above, or constrain the expected mock failure. My runtime probe covers the normal current-user forms, not tenant isolation, non-default host accounts or role-specific USING semantics. Those existing semantics are not established by this review.

At posting time preflight/shared build passed, while owning UT/SCA/coverage and active BVT checks were still queued/running. Merge should wait for required CI. I did not run complete owning-package suites or independently regenerate the parser.

Ordinary PR comment only; no formal review state changed.

@XuPeng-SH

XuPeng-SH commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

mo-bot review · mo-bot-local · done

Commit: 5c5759ad0f43e79c31977578fcba8bb6efe59187

Assessment: approve

Reviewed the complete five-file delta and affected parser, formatter, frontend and planner paths. Both CURRENT_USER forms reuse existing session identity resolution and grant execution. No actionable PR-introduced defect found.

Model: gpt-6-astra / xhigh

Session: 01a12d8f-7dea-77c2-a565-38d45b5564e4 · slot 0 · generation 0

Validation:

  • Independently regenerated the parser using the frozen repository generator: byte-identical output and zero parsing conflicts.

  • Reused exact-head evidence in comment 6120399021: targeted tests passed, and an authenticated SQL probe returned identical nonempty grant multisets for both new forms, SHOW GRANTS and the explicit current account.

  • Frozen CI records successful UT, SCA, coverage, proxy BVT, pessimistic multi-CN BVT and required checks.

  • Reviewed all supplied comments, syntax boundaries, identity ownership, compatibility and resource implications.

  • Verified assigned HEAD, clean source checkout and passing git diff --check.

Limitations:

  • Planner cases still only log planning errors; accepted as a nonblocking coverage weakness given the parser assertions and reported exact-head execution probe.

  • Runtime evidence was reused from the frozen author report; no native tests were rerun.

  • The linked issue's full text was unavailable; scope follows the frozen PR's explicit behavioral contract.

  • No independent tenant, non-default-host, USING-semantics or performance tests were run; unchanged behavior is not claimed newly validated.

@XuPeng-SH XuPeng-SH left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mo-bot review · mo-bot-local · review

Commit: 5c5759ad0f43e79c31977578fcba8bb6efe59187

Assessment: approve

Reviewed the complete five-file delta and affected parser, formatter, frontend and planner paths. Both CURRENT_USER forms reuse existing session identity resolution and grant execution. No actionable PR-introduced defect found.

Model: gpt-6-astra / xhigh

Session: 01a12d8f-7dea-77c2-a565-38d45b5564e4 · slot 0 · generation 0

Validation:

  • Independently regenerated the parser using the frozen repository generator: byte-identical output and zero parsing conflicts.

  • Reused exact-head evidence in comment 6120399021: targeted tests passed, and an authenticated SQL probe returned identical nonempty grant multisets for both new forms, SHOW GRANTS and the explicit current account.

  • Frozen CI records successful UT, SCA, coverage, proxy BVT, pessimistic multi-CN BVT and required checks.

  • Reviewed all supplied comments, syntax boundaries, identity ownership, compatibility and resource implications.

  • Verified assigned HEAD, clean source checkout and passing git diff --check.

Limitations:

  • Planner cases still only log planning errors; accepted as a nonblocking coverage weakness given the parser assertions and reported exact-head execution probe.

  • Runtime evidence was reused from the frozen author report; no native tests were rerun.

  • The linked issue's full text was unavailable; scope follows the frozen PR's explicit behavioral contract.

  • No independent tenant, non-default-host, USING-semantics or performance tests were run; unchanged behavior is not claimed newly validated.

@mergify mergify Bot added the queued label Oct 12, 2026
@mergify

mergify Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-12 10:25 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-10-12 10:30 UTC · at 45cbc7fe16fa176882917687ed036113edb69880

This pull request spent 5 minutes 3 seconds in the queue, with no time running CI.

Reason

Pull request #29993 has been dequeued

Pull request from fork cannot be queued. This pull request comes from a fork, and Mergify needs the author's permission to update its branch.

The author needs to enable "Allow edits from maintainers" on this pull request.

Hint

You should look at the reason for the failure and decide if the pull request needs to be fixed or if you want to requeue it.
If you do update this pull request, it will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue instead, you can requeue the pull request, without updating it, by posting a @mergifyio queue comment.

Waiting for any of
  • check-neutral = CI Required
  • check-skipped = CI Required
  • check-success = CI Required
All conditions

Tick the box to put this pull request back in the merge queue (same as @mergifyio queue).

  • Requeue this pull request

mergify Bot pushed a commit that referenced this pull request Oct 20, 2026
Metabase sync-fields queries produce computed BOOLEAN results that Connector/J must expose as Number. Advertise these results with TINYINT width 8 while retaining BOOL value encoding. Stored BOOLEAN columns keep width 1 and Java Boolean metadata. The separate SHOW GRANTS parser issue was fixed by #29993.

Resolve value provenance through the existing JOIN routing owner, keeping origin/key barriers intact. An extraction-local dependency graph handles shared/recursive producers without repeated traversal or output-order-dependent false results. It follows the correct aggregate/SAMPLE offsets, set-operation ownership, MARK markers and window value/default arguments. Lazy projection/binding indexes avoid repeated wide-JOIN scans; immutable reference keys reduce graph storage without a global cache or plan mutation. Non-BOOL outputs bypass classification.

Validation on the rebased source includes normal/race metadata and affected lifecycle tests, incremental SCA across the complete 11-package delivery closure, and real Connector/J 8.4.0 execution: 222 JOIN/composed cases, 144 MARK cases and the window probe, covering Statement, client-prepared and verified server-prepared execution.

Identical real-binder shared/recursive probes preserve result kinds and node counts. Compact keys reduce allocated bytes at the larger sizes from 32.9 to 20.1 MB (stored BOOL), 28.4 to 17.2 MB (computed BOOL), and 155.4 to 95.7 MB (recursive). These are metadata-extraction TotalAlloc measurements, not peak memory or SQL throughput. Full CI and TP throughput are not claimed.

Approved by: @XuPeng-SH, @aptend, @aunjgr

This branch was previously deployed

1 inactive deployment
ci — 45cbc7fe Deployed Oct 12, 2026 by mergify[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

kind/bug Something isn't working size/XXL Denotes a PR that changes 2000+ lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants