Snowflake: decode octal/hex/unicode string-literal escapes - #17
Merged
Conversation
Decode \ooo, \xhh and \uhhhh as Unicode code points, keep \0 as NUL, collapse unrecognized letters (\a, \Z) to the bare letter, and raise a tokenizer error on malformed \x / \u — gated behind a new supports_snowflake_string_literal_escapes dialect capability so other backslash-escaping dialects keep MySQL/BigQuery semantics. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
…less_return_with_question_mark) Pre-existing lints in ast/parser/tests/examples surfaced by the stable toolchain advancing to rust-1.97 (main last passed CI on the older stable). Mechanical fixes only; no behaviour change. Unrelated to the escape-parity commit but required to get this PR's lint job green. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
wojpadlo
force-pushed
the
lav-1329-escapes-on-main
branch
from
July 30, 2026 11:07
d5f5542 to
dba3a43
Compare
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.
Decodes Snowflake single-quoted string-literal escapes in the tokenizer:
\ooo(octal),\xhh(hex) and\uhhhh(unicode) → the corresponding code point\0stays NUL\a,\Z, …) collapse to the bare letter\x/\uraise a tokenizer errorGated behind a new
supports_snowflake_string_literal_escapesdialect capability so other backslash-escaping dialects keep their MySQL/BigQuery semantics.Files:
src/tokenizer.rs,src/dialect/mod.rs,src/dialect/snowflake.rs,tests/sqlparser_common.rs.Why
Parser-fork side of LAV-1329 ("string-literal escape parity"), and a prerequisite for LAV-1330 (multi-character
FIELD_DELIMITER/RECORD_DELIMITERon the CSV load path), which needs a hex-escaped delimiter likeFIELD_DELIMITER = '\x7C\x7C'to decode to||. The currently pinned fork rev (b5e11f27) maps unknown escapes to the bare char (\x7C→x7C), so the emulator never sees||; real Snowflake decodes it.Note
This is the same single commit as #16, but rebased directly onto
maininstead of stacked on thelav-1362-masking-policybranch. The escape commit cherry-picks cleanly ontomain(onlytokenizer.rs+dialect/*+ one test), decoupling it from the red feature-branch stack so it can merge and be consumed independently. Superseding #16.🤖 Generated with Claude Code