Skip to content

fix(plan): preserve prepare context for SHOW COLUMNS WHERE parameters - #32414

Merged
XuPeng-SH merged 5 commits into
matrixorigin:mainfrom
ck89119:issue-32408-main
Nov 9, 2026
Merged

XuPeng-SH merged 5 commits into
matrixorigin:mainfrom
ck89119:issue-32408-main

Conversation

@ck89119

@ck89119 ck89119 commented Nov 9, 2026

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:

Fixes #32408

What this PR does / why we need it:

Preserve the prepare flag when rewriting SHOW COLUMNS/FIELDS ... WHERE into a SELECT. Previously, the rewritten SELECT was always bound outside prepare mode, so valid WHERE parameter markers failed during both SQL PREPARE and COM_STMT_PREPARE.

  • Pass the prepare flag explicitly from the SHOW COLUMNS planning entry point to the rewritten WHERE query. Other SHOW callers retain their existing non-prepare behavior, and ordinary statements still reject unbound parameter markers.
  • Preserve existing result metadata, including MatrixOne's Comment column, authorization checks, and table/view dependency refresh.
  • Add planner coverage for SQL-string and AST prepare entry points, parameter counts, reusable ASTs, dependencies, and the non-prepared rejection control.
  • Add real-client SQL and binary prepare coverage for tables/views, COLUMNS/FIELDS, FULL output, repeated bindings, empty/NULL results, schema refresh, and denied access.
  • Extend the existing metadata BVT with single/multiple parameters, quoted column names, empty results, and view schema refresh. This does not add LIKE ? syntax.

Validation (macOS arm64, Go 1.27.1, repository CGo test wrapper):

  • Before the fix, all eight parameterized planner subcases failed with only prepare statement can use ? expr; the literal and non-prepare controls passed.
  • Focused SHOW/planner regressions passed; the full pkg/sql/plan package passed with 86.0% statement coverage. Statements associated with changed production blocks were covered 9/9.
  • TestShowColumnsPreparedWhere passed with -count=2, exercising explicit driver preparation with interpolateParams=false as well as SQL PREPARE/EXECUTE.
  • make -j8 build, gofmt, and incremental vet/lint for pkg/sql/plan and pkg/tests/issues passed (golangci-lint 2.14.0, zero issues).
  • mo-tester generated the updated result file, which was manually checked. Two same-instance comparison runs each passed 38/38 statements; an additional metadata-enabled comparison also passed 38/38. Fixture cleanup was verified, and the owned service was stopped.

Validation is local; no claim is made that full repository CI or the entire historical integration-issue suite has run.

@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 →

@XuPeng-SH

XuPeng-SH commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 25d55b442a59a31a55d55d8d166945a6ac0be2b6

Review completed. Read the assessment.

@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: 25d55b442a59a31a55d55d8d166945a6ac0be2b6

Assessment: approve

The fix narrowly preserves prepare mode through the existing SHOW rewrite, retaining authorization, dependency refresh and result metadata. Tests reuse the authenticated cluster and existing metadata BVT. No actionable findings remain.

Model: gpt-6.1-sol / max

Session: 01a1a004-90c3-73b1-acc9-3d4636452003 · slot 0 · generation 0

Validation:

  • Reviewed all six changed files, relevant owners/consumers, linked issue 32408 and every discussion entry; complete discussion ledger saved.

  • Eight focused planner regressions and the full pkg/sql/plan package passed: 4860 top-level tests, with two existing subtests skipped.

  • TestShowColumnsPreparedWhere passed twice in one process using actual binary and SQL preparation, including rebinding, NULL/empty results, schema refresh and denied access.

  • Exact baseline production overlays reproduced the intended error in all eight parameterized SQL/AST cases; candidate cases and nearest controls passed.

  • Go 1.27.1 isolation preflight, fresh native build, native integrity, formatting and clean-source checks passed. Receipts and retained logs are mapped in validation-reconciliation.json.

  • Supplied exact-head CI reports successful build, x86 UT/coverage, arm64 SCA and BVT checks.

Limitations:

  • The updated mo-tester case was not rerun locally; supplied CI statuses and author comparison reports lack raw per-case execution logs.

  • The full historical issues suite and an additional race campaign were not rerun locally.

@mergify mergify Bot added the queued label Nov 9, 2026
@mergify

mergify Bot commented Nov 9, 2026 •

Copy link
Copy Markdown
Contributor

🚫 Left the queue · pull request dequeued

1 h 19 min in the queue, with no time running CI.

So far

  • ✅ Entered the queue Mon 9 Nov, 13:32 · rule main · triggered by rule Automatic queue on approval for main
  • ⏹️ Testing stopped · in place
  • 🚫 Left the queue 14:51 · 3424659

Reason

Pull request #32414 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.

To get back in the queue

  • Push a change if one is needed: the pull request is queued again once its queue conditions match.
  • If no change is needed, tick the box below to queue it again as it is.

Merge conditions not met when it left the queue

  • any of · required by GitHub branch protection:
    • check-neutral = CI Required
    • check-skipped = CI Required
    • check-success = CI Required

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

  • Requeue this pull request
2 merge conditions met
  • #review-threads-unresolved = 0 · required by GitHub branch protection
  • github-review-approved · required by GitHub branch protection

Times in UTC · dashboard · how the merge queue works

This branch was previously deployed

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

Labels

dequeued kind/bug Something isn't working size/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: SHOW COLUMNS/FIELDS rejects WHERE parameter markers during PREPARE

3 participants