Repository navigation
skip length validation when casting TEXT to CHAR/VARCHAR to hotfix - #23370
Merged
5 commits merged intoDec 24, 2025
Merged
5 commits merged into
5 commits merged into
Conversation
Problem: When updating TEXT columns with CONCAT operations in UPDATE statements, the system throws an error: 'Can't cast column from TEXT type to CHAR type because of one or more values in that column. Src length 260 is larger than Dest length 255'. Root Cause: The strToStr function was performing length validation for all string type casts, including when casting from TEXT (which has no length limit) to CHAR/VARCHAR types. This caused errors when TEXT values exceeded the target type's length limit, even though TEXT should be allowed to store strings of any length. Solution: - Added source type check in strToStr function to detect when source is TEXT - Skip length validation when casting from TEXT to CHAR/VARCHAR types - This allows TEXT columns to be updated with CONCAT operations that may exceed CHAR/VARCHAR length limits - The storage layer will handle the actual type correctly Changes: - Modified strToStr() in func_cast.go to skip length check for TEXT source - Added comprehensive unit tests in func_cast_test.go covering: * TEXT to CHAR conversions with length exceeding target limit * TEXT to VARCHAR conversions with length exceeding target limit * NULL value handling * Multiple values scenarios * Verification that non-TEXT types still perform length validation Test: Test_strToStr_TextToCharVarchar
- Add ALTER ROLE RENAME TO syntax support in parser - Implement doAlterRole function in frontend to handle role renaming - Add privilege checks for ALTER ROLE statement - Add comprehensive e2e tests using DSN connection: * Basic rename functionality * IF EXISTS handling * Error cases (non-existent role, existing role/user name, predefined roles) * Multiple sequential renames * Role grant persistence after rename verification - All tests use DSN connection instead of internal SQL executor
zhangxu19830126
requested review from
aunjgr,
daviszhen,
iamlinjunhong and
ouyuanning
as code owners
December 24, 2025 08:30
iamlinjunhong
approved these changes
Dec 24, 2025
daviszhen
approved these changes
Dec 24, 2025
ouyuanning
approved these changes
Dec 24, 2025
ghost
approved these changes
Dec 24, 2025
This pull request was closed.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What type of PR is this?
Which issue(s) this PR fixes:
issue #23176
What this PR does / why we need it:
Problem:
When updating TEXT columns with CONCAT operations in UPDATE statements, the system throws an error: 'Can't cast column from TEXT type to CHAR type because of one or more values in that column. Src length 260 is larger than Dest length 255'.
Root Cause:
The strToStr function was performing length validation for all string type casts, including when casting from TEXT (which has no length limit) to CHAR/VARCHAR types. This caused errors when TEXT values exceeded the target type's length limit, even though TEXT should be allowed to store strings of any length.
Solution:
Added source type check in strToStr function to detect when source is TEXT
Skip length validation when casting from TEXT to CHAR/VARCHAR types
This allows TEXT columns to be updated with CONCAT operations that may exceed CHAR/VARCHAR length limits
The storage layer will handle the actual type correctly
Changes:
Modified strToStr() in func_cast.go to skip length check for TEXT source
Added comprehensive unit tests in func_cast_test.go covering:
TEXT to CHAR conversions with length exceeding target limit
TEXT to VARCHAR conversions with length exceeding target limit
NULL value handling
Multiple values scenarios
Verification that non-TEXT types still perform length validation
Test: Test_strToStr_TextToCharVarchar