Repository navigation
Keep Unicode whitespace at the edges of array elements - #53
Merged
Merged
Conversation
PostgreSQL quotes an array element only when it contains ASCII
whitespace, so an element that starts or ends with a no-break space
or another Unicode space separator arrives unquoted. This test reads
such elements untyped and through a typed Vector{String} field.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
PostgreSQL's array output quotes an element only when it contains ASCII whitespace, so an element that starts or ends with U+00A0 (no-break space), U+3000, or another Unicode space separator arrives unquoted. parse_unquoted trimmed elements with Base.strip, which also removes those characters, so they were silently dropped from decoded text, varchar, and char arrays, untyped and typed alike. Trim only the ASCII whitespace the array grammar itself ignores. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The server quotes every element that contains ASCII whitespace, so the trailing-whitespace trim could only run on text the server never sends. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.
Why
Text array elements lost a leading or trailing no-break space (U+00A0), ideographic space (U+3000), or other Unicode space when read. The array parser trimmed elements with
Base.strip, which removes Unicode space separators. PostgreSQL quotes an array element only when it contains ASCII whitespace, so these characters arrive unquoted and belong to the element.For example,
SELECT ARRAY[E'\u00a0lead', E'trail\u00a0']returned["lead", "trail"].What changed
Scope
Vector{String}fields overtext[],varchar[], andchar(n)[]columns.Blast Radius
Only array elements that start or end with non-ASCII whitespace decode differently. They now match what the server stores. Hand-written literals with a space after an unquoted element (
{1 ,2}) would now keep it, but the parser only reads server output.Verification
Type Parsing: fails on main (the decoded array is["lead", "trail", ...]), passes with the fix.*sendfunctions) on PostgreSQL 13, 17, and 18. On main it found 14 text, varchar, and char arrays with this defect. With the fix it found none. No other result changed.parse_unquotedis the only array, range, or composite parser that trimmed. Whitespace before an element is still skipped. Server output never has whitespace after an unquoted element, and no unit test feeds one.🤖 Generated with Claude Code