Escape closing brackets in bracket-quoted identifiers - #2418
Open
hdimer wants to merge 1 commit into
Open
Conversation
A bracket-quoted identifier whose value contains ] (e.g. [a]]b], value a]b) serialized back to [a]b], which no longer re-parses. Double each ] on display, mirroring the tokenizer folding ]] into ]. Redshift nested quoted identifiers (["a]b"]) store the value as a complete double-quoted string whose inner ] is literal, so those are left unchanged. Fixes apache#2409 Signed-off-by: Haim Dimer <haim@dimer.org>
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.
Fixes #2409.
A bracket-quoted identifier whose value contains
](e.g.[a]]b], valuea]b) serialized back to[a]b], which no longer re-parses. This doubles each]on display, mirroring the tokenizer which folds]]into].Redshift also parses nested quoted identifiers like
["a]b"], whose value is stored as a complete double-quoted string ("a]b") with a literal inner]. The AST doesn't distinguish that from a plain bracket ident, so a value that is a complete"..."string is left unchanged; otherwise the]are doubled.Added a round-trip test; the existing Redshift nested-identifier test covers the verbatim case.
Used AI assistance on this; I reviewed and tested it.