Repository navigation
[4.2] fix: preserve NULL column defaults after TRUNCATE - #32406
Conversation
Qodo reviews are paused for this user.Troubleshooting steps vary by plan Learn more → On a Teams plan? Using GitHub Enterprise Server, GitLab Self-Managed, or Bitbucket Data Center? |
|
mo-bot review · Commit: Review completed. Read the assessment. |
XuPeng-SH
left a comment
There was a problem hiding this comment.
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.
What type of PR is this?
Which issue(s) this PR fixes:
Fixes #32344
What this PR does / why we need it:
TRUNCATE TABLErecreates the table fromSHOW CREATE TABLE. An implicit nullable default can consequently acquire the explicit origin textnull. On 4.2,information_schema.COLUMNS.COLUMN_DEFAULTreturns that text directly instead of SQL NULL, although inserted values andDESCremain correct.Normalize empty default origins and case-insensitive bare
NULLto SQL NULL inmo_show_visible_binmode 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 mergingmo/4.2-devata860d63a97:nullis non-NULL; the SHOW COLUMNS, ON UPDATE and malformed-input controls pass.pkg/sql/plan/functiontests pass through the repository CGo wrapper, including the new regression. Added production statements have 100% coverage.go vet, pinnedmolint, and configured golangci-lint 2.6.2 pass; golangci reports 0 issues.mo-servicebuilds with matching native dependencies.table/truncate_column_default.sqlpasses 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.These are local validation results, not a claim that remote CI has passed.