Repository navigation
fix(compiler): treat dollar-quoted strings as quoted text in variable substitution - #1020
Merged
Merged
Conversation
… substitution The native @@var fast path on the model path now scans with the shared compiler scanner, so dollar-quoted text is quoted exactly as in the pure-Python scanner and an unclosed dollar quote falls back to Python's interpolation error. Adds a native-versus-Python differential test, Rust cases, an E2E compile test on each engine, and harness cases.
…tachments path The native substitution scanner now reads dollar quotes like Python, so the preview ATTACHMENTS stage no longer hands SQL containing $ to the Python scanner. Adds dollar-heavy authored SQL parity and dollar-quoted attachment project SQL.
kvlonge
force-pushed
the
fix/dollar-quote-vars
branch
from
October 8, 2026 04:20
1a7a60b to
981b0ed
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.
Why
The native
@@varfast path that prepares every model's SQL on all engines did not treat$$...$$or$tag$...$tag$as quoted text, unlike the pure-Python scanner.SELECT $$--@@region$$kept@@region(Python:$$--north$$), and an unclosed$tag$failed later with "Enum and constant expansion" or "SQL reference" errors instead of "SQL interpolation contains an unclosed quoted string". The harness missed it because itspythonoracle shares the native path.Changes
non_code_end, compiler quote policy), which reads dollar quotes exactly like Python (tag grammar,$1anda$bare code). Unclosed quotes fall back to Python, which raises the interpolation error. Tokens inside quoted segments are substituted as in Python.$SQL to Python; the guard and the unusedSQL_DOLLAR_QUOTE_TOKENconstant are removed.expand_authored_sql_resultparity case (pythonvsnative-preview) on dollar-heavy strings with variables, enum/constant references and unclosed quotes; dollar-quoted SQL in the attachment project's source, unit test and audit; an E2Esqb compileDuckDB test on each engine; a harness generator line and failure-corpus case.Verification
cargo test --workspace --all-features, clippy, fmt (Rust 1.98.0)make compiler-differential,make compiler-differential-shipped,tests/e2e/scripts/compiler_differentialmake check-ci,make test