Skip to content

[4.2] fix: preserve NULL column defaults after TRUNCATE - #32406

Merged
XuPeng-SH merged 3 commits into
matrixorigin:4.2-devfrom
ck89119:issue-32344-4.2-dev
Nov 9, 2026
Merged

XuPeng-SH merged 3 commits into
matrixorigin:4.2-devfrom
ck89119:issue-32344-4.2-dev

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 #32344

What this PR does / why we need it:

TRUNCATE TABLE recreates the table from SHOW CREATE TABLE. An implicit nullable default can consequently acquire the explicit origin text null. On 4.2, information_schema.COLUMNS.COLUMN_DEFAULT returns that text directly instead of SQL NULL, although inserted values and DESC remain correct.

Normalize empty default origins and case-insensitive bare NULL to SQL NULL in mo_show_visible_bin mode 1. This is a three-line, release-scoped fix: quoted string defaults such as 'null', empty strings, numeric defaults and expressions retain their existing 4.2 representation. It does not backport the broader string-decoding changes from main or change TRUNCATE, catalog storage, or default evaluation.

Add mixed-vector unit coverage for NULL/value distinctions, unchanged SHOW COLUMNS and ON UPDATE modes, and malformed input. Add a standalone SQL regression covering metadata before/after TRUNCATE, repeated TRUNCATE, a fresh connection, SHOW CREATE/DESC stability, and omitted-column inserts. NULL flags and HEX distinguish real strings from SQL NULL.

Validation

Validated on macOS/arm64 with Go 1.26.4 at 325b296627, after merging mo/4.2-dev at a860d63a97:

  • Before the fix, the new regression fails because bare null is non-NULL; the SHOW COLUMNS, ON UPDATE and malformed-input controls pass.
  • Full pkg/sql/plan/function tests pass through the repository CGo wrapper, including the new regression. Added production statements have 100% coverage.
  • Incremental go vet, pinned molint, and configured golangci-lint 2.6.2 pass; golangci reports 0 issues.
  • mo-service builds with matching native dependencies.
  • table/truncate_column_default.sql passes twice in normal mo-tester comparison mode: 22/22 statements each time, no failed/skipped/abnormal statements. Database teardown is verified after each run, and the test-owned service is stopped.
  • The expected result was generated with mo-tester and reviewed; it was not regenerated to accommodate the baseline merge.

These are local validation results, not a claim that remote CI has passed.

@mergify
mergify Bot requested a review from XuPeng-SH November 9, 2026 06:25
@mergify mergify Bot added the kind/bug Something isn't working label Nov 9, 2026
@matrix-meow matrix-meow added the size/M Denotes a PR that changes [100,499] lines label Nov 9, 2026
@ck89119
ck89119 marked this pull request as ready for review November 9, 2026 08:17
@ck89119
ck89119 requested a review from aunjgr as a code owner November 9, 2026 08:17
@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: 325b2966272b53432fe62668c060c9ea127c83ba

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: 325b2966272b53432fe62668c060c9ea127c83ba

Assessment: approve

The release-scoped normalization reuses the existing default decoder and SHOW COLUMNS semantics. It restores SQL NULL metadata while preserving quoted defaults and default evaluation. No actionable findings remain.

Model: gpt-6.1-sol / max

Session: 01a1a004-9884-72c0-ad39-f096c4209c4a · slot 1 · generation 0

Validation:

  • Reviewed the complete four-file delta, linked issue #32344 and both discussion entries; traced default serialization, TRUNCATE reconstruction and information_schema/SHOW consumers.

  • Reused exact-head author evidence: full function-package tests, a failing baseline regression with passing controls, static checks and two successful 22-statement SQL/BVT runs.

  • The frozen latest substantive UT, SCA, coverage, PROXY and PESSIMISTIC BVT contexts completed successfully; older cancelled/failed contexts and skipped jobs receive no validation credit.

  • Bounded source/evidence audit passed, verifying the exact three-line production change, unchanged source, all discussion keys and four independent metadata-oracle groups. See source-evidence-audit.log, validation-ledger.json and checks/.

Limitations:

  • Go tests and SQL/BVT were not rerun locally; matching supplied author/CI evidence was reused. Raw author logs and the external reusable CI workflow are unavailable in the frozen record.

This branch was successfully deployed

No deployments
ci — 7e7fcfa7 Deployed Nov 9, 2026 by XuPeng-SH
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