fix: enforce TINYTEXT byte length limit - #26697
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? |
XuPeng-SH
left a comment
There was a problem hiding this comment.
Request changes: provide an upgrade path for existing TINYTEXT columns.
Before this PR, getTypeFromAst persisted every TEXT-family declaration, including TINYTEXT, as T_text with Width=0. This PR recognizes TINYTEXT only while parsing new DDL and all enforcement/formatting helpers key exclusively on T_text + Width=255.
Consequently, a TINYTEXT table created on any pre-fix version still resolves as Width=0 after upgrade. assignmentCastFunctionName then deliberately selects ordinary cast (the new test even asserts this for T_text/Width=0), so the original 1000-byte reproduction continues to store 1000 bytes. SHOW CREATE and CREATE TABLE ... LIKE also treat/copy that legacy column as unbounded TEXT. The fix therefore applies only to tables created or explicitly rebuilt after deployment.
Please add a durable subtype recovery/migration path (for example, versioned catalog metadata/backfill, or a carefully validated recovery from TableDef.Createsql) and define what happens when legacy columns already contain oversized rows. Add an upgrade regression that starts from a pre-fix catalog definition and verifies future strict/non-strict writes plus SHOW/LIKE behavior. The new-table byte-boundary, assignment-mode, DEFAULT, and formatting tests all pass on exact head a9dae6d80b97; the missing piece is existing-schema compatibility.
What type of PR is this?
Which issue(s) this PR fixes:
issue #26687
What this PR does / why we need it:
fix: enforce TINYTEXT byte length limit