Skip to content

fix(sql): expose Unicode collation in SHOW FULL COLUMNS - #29912

Merged
mergify[bot] merged 10 commits into
matrixorigin:mainfrom
daviszhen:codex/fix-show-full-columns-collation
Oct 12, 2026
Merged

mergify[bot] merged 10 commits into
matrixorigin:mainfrom
daviszhen:codex/fix-show-full-columns-collation

Conversation

@daviszhen

@daviszhen daviszhen commented Oct 11, 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:

Related to #29206
Related to #29904 (SHOW FULL COLUMNS collation metadata)

What this PR does / why we need it:

  • Expose native Unicode collations in SHOW FULL COLUMNS.
  • Keep SHOW FULL COLUMNS.Collation consistent with information_schema.COLUMNS for ordinary string columns.
  • Preserve NULL for binary and non-string columns, matching the MySQL contract.
  • Keep the existing utf8/utf8mb4 legacy and binary text mappings unchanged.
  • Add SQL integration coverage for native Unicode, legacy utf8, binary, varbinary, blob, numeric, ordinary string, and ENUM columns.
  • Preserve ENUM literal case, lengths, and privileges while fixing the collation envelope.

Native Unicode PRIMARY/UNIQUE index admission remains intentionally fail-closed and is not changed here.

This PR is scoped to the collation metadata portion of #29904. The shared type renderer's uppercase/legacy-width Type representation is intentionally unchanged; changing that format requires a separate MySQL-oracle-backed compatibility decision so existing metadata consumers and ENUM literal case are not regressed.

Validation:

  • ./.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/sql/plan -run 'Test(Coverage_buildShowColumns|ShowColumnsTracksTargetDependency|CollationMetadata.*)' -count=1 -timeout=20m
  • ./.agents/skills/mo-dev/scripts/mo-cgo-test ./pkg/tests/sqlintegration -run '^TestUnicodeCollationConsumerContract$' -count=1 -timeout=25m
  • make build (passed on the preceding implementation commits)
  • git diff --check

@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 8b3e960b04e4e30fec491d012d52c7380518b9e1 against 61d8e2887f0ae5b63e3baa7b399e3b10b9c47d6a.

Recommendation: request changes. One confirmed P2 compatibility regression.

P2: preserve NULL Collation for binary string columns

At pkg/sql/plan/build_show.go:705, WHEN 2 then 'binary' changes SHOW FULL COLUMNS for BINARY, VARBINARY and BLOB columns from NULL to the string binary. builtInInternalCharacterSet deliberately returns 2 for those storage types, so this is not restricted to character columns with a _bin text collation.

The MySQL SHOW COLUMNS contract specifies a collation for nonbinary string columns and NULL for other columns. This PR introduces incorrect introspection metadata for existing binary columns; mirroring the separate information_schema mapping does not establish the SHOW contract.

Independently reproduced with the exact-head embedded SQL server:

create table t(
  b binary(4), v varbinary(4), bl blob, n int,
  u varchar(20) collate utf8mb4_unicode_ci,
  txt varchar(20) collate utf8mb4_bin
);
show full columns from t;

The probe explicitly asserted non-NULL binary for b/v/bl and NULL for n; it passed, confirming the regression rather than merely inspecting the SQL string. Please map identity 2 to NULL in this SHOW expression (without removing the valid utf8mb4_bin text mapping), and add binary/nonstring controls alongside the Unicode assertions. The shared expression affects both system-account and tenant query branches; the independent runtime reproduction used the system account.

Validation: the modified TestUnicodeCollationConsumerContract passed against the exact head with linked CGo; targeted ShowColumns/buildShowColumns planner tests and full PR git diff --check passed. Both changed files and the metadata decoder/system-view mappings were inspected. No product code was changed by this review.

Separate merge prerequisite: CI preflight failed in the PR-content action because the PR body is empty; CI Required failed and the main test/build workflows were skipped. Fill in the required description sections and obtain green required CI. The skipped checks are not validation evidence.

Ordinary PR comment only; no formal review state changed.

@daviszhen

Copy link
Copy Markdown
Contributor Author

Addressed the review findings in commit 2a0208fe40.

  • Selector 2 now maps to SQL NULL in SHOW FULL COLUMNS, preserving binary/varbinary/blob and numeric metadata.
  • utf8mb4_bin remains exposed for nonbinary text columns.
  • Added regression coverage for binary, varbinary, blob, numeric, utf8mb4_bin, utf8_unicode_ci, and utf8mb4_unicode_ci.
  • Filled the PR description using the repository template so CI preflight can run.

Local validation passed:

  • targeted pkg/sql/plan tests
  • TestUnicodeCollationConsumerContract
  • make build
  • git diff --check

@daviszhen

Copy link
Copy Markdown
Contributor Author

Re-reviewed current head 2a0208fe406612543c2c6c39df0a2f64193903dc, including the fix since 8b3e960b04 and the complete two-file PR diff.

Recommendation: approve from the code-review perspective, subject to required CI passing. The P2 binary-column Collation regression in my previous comment is resolved; this supersedes that old-head request-changes recommendation. No additional confirmed blocker.

Removing selector 2 makes BINARY/VARBINARY/BLOB fall through to SQL NULL while retaining selector 1's utf8mb4_bin for nonbinary text and selectors 4/5's native Unicode names. Numeric types continue returning NULL through the decoder. The test helper now distinguishes actual SQL NULL from an empty string, and the added regression assertions cover the previously missing binary/nonstring controls. The shared expression is used by both system-account and tenant branches without changing their visibility predicates or non-FULL output.

Fresh exact-head validation with linked CGo:

  • TestUnicodeCollationConsumerContract passed, including UTF8MB3/UTF8MB4 Unicode names, BINARY/VARBINARY/BLOB/INT NULL controls and utf8mb4_bin text.
  • The independent embedded SQL reproduction from the previous round was rerun with NULL expectations for binary columns and passed.
  • Targeted ShowColumns/buildShowColumns and CollationMetadata planner tests passed.
  • Full PR git diff --check passed.

Runtime checks used the system account; I did not independently execute a tenant SQL scenario or run the complete repository suite. No product code was modified by this review.

The PR description is now populated and current-head CI preflight passed, resolving the prior content-check failure. Ubuntu UT, SCA, coverage and shared build remain in progress at posting time; merge should wait for required checks to pass. This review does not change native PRIMARY/UNIQUE activation scope.

Ordinary PR comment only; no formal approval/review state changed.

@XuPeng-SH

XuPeng-SH commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

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

Commit: 7ac411878bd8af6a6eb2d28ff144d7ee53dcc7d2

Assessment: approve

Reviewed the complete six-file delta and all supplied review concerns. The shared SHOW mapping exposes supported text collations while preserving binary/non-string NULLs, visibility rules and non-FULL output. The earlier binary-column regression is resolved; no actionable findings remain.

Model: gpt-6-astra / xhigh

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

Validation:

  • Verified the frozen HEAD, clean source checkout and patch contents; Go formatting and Go-only diff checks passed.

  • Traced the encoded-type decoder, information_schema mapping, table/view metadata sources, system/tenant branches, filtering and frontend result metadata.

  • Reviewed integration assertions for Unicode, default text, binary controls, numeric NULLs and ENUM literal preservation, including fixture cleanup.

  • Reused current-head successful Ubuntu UT, shared build, arm64 static analysis, coverage, PROXY BVT and pessimistic multi-CN BVT evidence; checked relevant test selection.

  • Verified all 11 golden-row changes affect only Collation. Full diff-check reports seven retained trailing-whitespace lines representing empty Comment fields.

  • Recorded the review in attempt-1/review-audit.json.

Limitations:

  • No local native tests or SQL replay were run; supplied CI evidence contains status summaries rather than detailed logs.

  • Linked issue bodies were not supplied; scope was assessed from the frozen PR description and comments.

  • Existing ENUM NULL behavior, Type formatting and native Unicode index admission remain explicitly outside scope.

  • Performance was assessed structurally: bounded decoding per SHOW metadata row, with no normal SQL execution-path change; no benchmark was run.

@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: 7ac411878bd8af6a6eb2d28ff144d7ee53dcc7d2

Assessment: approve

Reviewed the complete six-file delta and all supplied review concerns. The shared SHOW mapping exposes supported text collations while preserving binary/non-string NULLs, visibility rules and non-FULL output. The earlier binary-column regression is resolved; no actionable findings remain.

Model: gpt-6-astra / xhigh

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

Validation:

  • Verified the frozen HEAD, clean source checkout and patch contents; Go formatting and Go-only diff checks passed.

  • Traced the encoded-type decoder, information_schema mapping, table/view metadata sources, system/tenant branches, filtering and frontend result metadata.

  • Reviewed integration assertions for Unicode, default text, binary controls, numeric NULLs and ENUM literal preservation, including fixture cleanup.

  • Reused current-head successful Ubuntu UT, shared build, arm64 static analysis, coverage, PROXY BVT and pessimistic multi-CN BVT evidence; checked relevant test selection.

  • Verified all 11 golden-row changes affect only Collation. Full diff-check reports seven retained trailing-whitespace lines representing empty Comment fields.

  • Recorded the review in attempt-1/review-audit.json.

Limitations:

  • No local native tests or SQL replay were run; supplied CI evidence contains status summaries rather than detailed logs.

  • Linked issue bodies were not supplied; scope was assessed from the frozen PR description and comments.

  • Existing ENUM NULL behavior, Type formatting and native Unicode index admission remain explicitly outside scope.

  • Performance was assessed structurally: bounded decoding per SHOW metadata row, with no normal SQL execution-path change; no benchmark was run.

@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 11:38 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ❌ Checks failed · in-place
  • 🚫 Left the queue — 2026-10-12 13:29 UTC · at ab1a53a770800202663428e6b9550174b5dcc98c

This pull request spent 1 hour 51 minutes 12 seconds in the queue, with no time running CI.

Reason

The merge conditions cannot be satisfied due to failing checks

  • Mergify Merge Protections
  • CI Required

Hint

You may have to fix your CI before adding the pull request to the queue again.
If you update this pull request, to fix the CI, 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

Requeued — the merge queue status continues in this comment ↓.

@daviszhen

Copy link
Copy Markdown
Contributor Author

已排查上一轮失败检查:Ubuntu/x86 UT 未进入编译/测试,checkout PR commit 时连续三次出现 gnutls_handshake() failed;随后因未生成 scratch/ut-report 触发连锁失败,CI Required 也随之失败。未发现 #29912 代码测试失败。已使用 gh run rerun 38243952611 --failed 重跑失败 job,等待基础设施重试结果。

@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 16:23 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • ✅ Checks passed · in-place
  • ✅ Merged — 2026-10-12 20:20 UTC · at a175874609d55887436b948a0f21e6f4613fc122 · squash

This pull request spent 3 hours 57 minutes 7 seconds in the queue, including 1 hour 33 minutes 52 seconds running CI.

Required conditions to merge

@mergify mergify Bot removed the dequeued label Oct 12, 2026

This branch was previously deployed

1 inactive deployment
ci — 46f7d293 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/M Denotes a PR that changes [100,499] lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants