Skip to content

fix: reject unsupported MEDIUMINT aliases - #29758

Merged
XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
Lundomn:codex/issue-29723
Oct 9, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:mainfrom
Lundomn:codex/issue-29723

Conversation

@Lundomn

@Lundomn Lundomn commented Oct 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 #29723

What this PR does / why we need it:

MEDIUMINT and its INT3 alias parse as MYSQL_TYPE_INT24, but the planner was mapping that type to signed or unsigned INT32, silently accepting values outside the MEDIUMINT range. This change routes INT24 through the existing not-implemented error path while keeping ordinary INT mappings unchanged. The issue-25103 information_schema regression now uses supported signed and unsigned SMALLINT columns and retains its precision, nullability, scale, other metadata, and foreign-key assertions.

Validation on rebased head 18b848532282d813611d04995e584ff706cba6c0:

  • .agents/skills/mo-dev/scripts/mo-cgo-test -run '^TestIssue25103InformationSchemaMetadata$' -count=1 ./pkg/tests/issues
  • .agents/skills/mo-dev/scripts/mo-cgo-test -run 'TestGetTypeFromAstRejectsMediumIntAliases|TestBuildCreateTableRejectsMediumInt|TestBuildCastToMediumIntIsRejected' -count=1 ./pkg/sql/plan
  • .agents/skills/mo-dev/scripts/mo-cgo-test -count=1 ./pkg/sql/plan
  • git diff --check and gofmt -d are clean.

A direct MySQL protocol smoke on the preceding planner base 23d8f6125 verified INT accepts 8388608, while MEDIUMINT CREATE and CAST return the not-implemented diagnostic. The full mo-tester DATALINK case and performance benchmarks were not run.

Compatibility note: this rejects new MEDIUMINT/INT3 declarations and casts; it does not add 24-bit storage or migrate existing columns, which keep their current INT metadata. Stored views that reparse explicit MEDIUMINT/INT3 casts may fail after upgrade. The change is planning-time only and adds no row-processing checks.

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

@aunjgr aunjgr 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.

APPROVE at 18b8485. Declared base is b6fa8cc; actual merge-base is dca6ffc. No blocking finding confirmed in the five-file PR range.

The change closes the unsupported-type admission boundary at the existing AST-to-type owner: MEDIUMINT/INT3 no longer fall through to INT32, and unsigned INT24 follows the same existing not-implemented path. Ordinary signed/unsigned INT mappings are unchanged. This is explicit rejection of an unsupported declaration, not partial24-bit storage or per-row range enforcement. CREATE/ALTER/CAST consumers share this owner.

Reviewed every changed hunk and surrounding default error path. Tests cover MEDIUMINT, unsigned MEDIUMINT, INT3, CREATE and CAST rejection with the specific error class, plus ordinary INT controls. The information_schema fixture now uses supported signed/unsigned SMALLINT with matching precision, while retaining its nullability/scale and neighboring metadata/FK assertions. The DATALINK result changes only the earlier inner-MEDIUMINT rejection diagnostic. No storage format, resource lifecycle or row-processing behavior is added.

Evidence reused: exact-head required CI, UT/SCA/coverage and proxy/pessimistic BVT are successful. The author reports current-head focused and complete planner tests plus the adjusted metadata integration case; these were not independently rerun locally in this pass. The documented compatibility limit remains: existing physical INT metadata is unchanged, but stored SQL definitions explicitly reparsing MEDIUMINT/INT3 can now fail. No migration or full old-binary upgrade proof is claimed.

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

Deep review: APPROVE at 18b848532282d813611d04995e584ff706cba6c0, against merge-base dca6ffc2bf21036627b221b67f05943fbe458cf0. Performed directly without subagents. No blocking finding.

Reviewed all five changed files/hunks, issue #29723, review history, and the shared AST-to-type callers. This focused bug fix removes the unsupported INT24 admission at its existing owner. MEDIUMINT/INT3, including unsigned forms and nested ARRAY element validation, reach the existing NYI result; CREATE/ALTER/CAST/procedure-type consumers reuse that owner. Ordinary signed/unsigned INT stays unchanged. No row checks, state machine, storage format, execution path or cleanup owner is added. The implementation is proportional (+1/-1); tests/results are +80/-19, docs unchanged.

Tests distinguish aliases and signedness, check the specific error class, and retain INT controls. The information_schema fixture switches its two unsupported declarations to supported SMALLINT while retaining precision/nullability/scale, other metadata and FK assertions. The DATALINK expectation correctly reports the earlier inner-cast rejection. No actionable earlier comment remains.

Reused exact-head CI run 37895962649: UT/SCA and BVT passed. Downloaded artifacts confirm TestIssue25103InformationSchemaMetadata passed (3.82s), owning planner shards completed, and func_load_file_datalink.sql actually executed 82/82 checks successfully (0.304s). Author focused/complete planner results were considered separately; no duplicate local suite run was needed. Diff whitespace check passed.

Compatibility limit: pre-existing physical columns retain their INT metadata, but stored SQL explicitly reparsing MEDIUMINT/INT3 can fail after upgrade. This follows the documented unsupported-type rejection scope; this review does not claim a stored-SQL migration. No runtime TP overhead is introduced by the admission change.

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

mergify Bot commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • ✅ Entered queue — 2026-10-09 08:37 UTC · Rule: main · triggered by rule Automatic queue on approval for main
  • 🟠 Checks running · in-place
  • 🚫 Left the queue — 2026-10-09 08:45 UTC · at 2b7a503b74a635a0d7f267328b9ec2fddd2dc627

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

Reason

The pull request can't be updated

This pull request seems to come 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, or update the branch manually.

Hint

You should update or rebase your pull request manually. If you do, this pull request will automatically be requeued once the queue conditions match again.
If you think this was a flaky issue, 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

This branch was previously deployed

1 inactive deployment
ci — 2b7a503b Deployed Oct 9, 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.

[Bug]: MEDIUMINT is silently created as INT and accepts out-of-range values

4 participants