SS-124: SQL Server: Improve handling of CHAR(N) type when dealing with multi-byte encoding#37424
Draft
martykulma wants to merge 3 commits into
Draft
SS-124: SQL Server: Improve handling of CHAR(N) type when dealing with multi-byte encoding#37424martykulma wants to merge 3 commits into
martykulma wants to merge 3 commits into
Conversation
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.
SQL Server
CHAR(N)type limits the number of bytes, not characters. Under different collations, this column has variable character length. Materialize expects this to contain a consistent character length.This PR adds the test from the bug report, fix, and a minor doc addition about the encoding.
The fix has 2 parts:
CHAR(N)asSTRING, so there is no character length validation, and Materialize displays the string consistently with the upstream DB.CHARACTERwith padding, but the check is relaxed to only error if the character length is greater than the byte length. This is a deprecated code path, so I didn't modify the error.Fixes https://linear.app/materializeinc/issue/SS-124/sql-server-charn-with-utf-8-expected-n-chars-found-less-than-n
There are some formatting changes in the PR, so view with ignore white space