Repository navigation
Tokenizer and depth fixes, iterative tree drop, account and property quoting, interval qualifier precision, anonymous procedure gaps - #63
Merged
Conversation
…as one depth level - The tokenizer refuses an unterminated /* at its opening, as it does an unterminated string; the refusal is the parse diagnostic SQ0001 with its span. - The AST depth guard counts a left-associative chain such as 1 + 1 + ... as one level, so a 50,000-term sum parses; real nesting (600 unary minus signs) is still refused with E_GUARD_AST_DEPTH_EXCEEDED. - Dropping a long operator chain frees it with a worklist, so it cannot overflow the stack.
ACCOUNTS lists in release channels, release directives and replication or failover now keep [ organization . ] account as a table reference with each part quoted separately, instead of one joined identifier. ALTER SET and UNSET property kinds upper-case only unquoted names, so a quoted name such as "v1 Q" keeps its case.
Receipts show Snowflake parses a parameter or RETURNS TABLE column given by its name alone, a name as a RUNTIME_VERSION, HANDLER, IMPORTS or PACKAGES value, and an expression CTE body after an anonymous procedure, as WITH p AS PROCEDURE ... , c AS ( 1 ) CALL p ( ). A lone part now has an unknown type; quoted strings and reserved words stay rejected.
INTERVAL '1' YEAR(9) TO MONTH parsed as a YEAR call spanning a MONTH variable, and SECOND(9), (3) left the fractional precision as a second select item. In Snowflake's faithful modes a qualifier with a field precision is now an interval qualifier node with its fields and its leading and fractional seconds precisions. Qualifiers without a precision keep their span or simple shape.
A 70,000-term chain of ::, [1], .a, COLLATE, IS NULL or IN, or one mixing them with = or +, overflowed the stack while its tree was dropped, even after the depth guard had refused it. The AstNode derive now generates take_expressions, which moves a node's direct expression children out. BinaryOp, Cast, CollationExpr, DotAccess, In, IsNull, IsTrueFalse, JsonExtractFunc, LikeOp, Subscript, UnaryOp, Alias and Between drop through one worklist built on it, so any node between two chain links is freed iteratively too. This replaces the BinaryOp-only worklist.
Contributor
Author
|
Gate (D94) and landing record.
|
kvlonge
added a commit
that referenced
this pull request
Nov 5, 2026
…hold 2 receipts from run ivl-q: the CAST form is syntax error 1003; the control executes as two select items.
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.
Parser batch after gaps-f (#61): the tokenizer and depth fixes, three auditor withholds, and the anonymous-procedure part of the D133 remainder.
Tokenizer and depth (product lane)
/*comment is refused with SQ0001 "Unterminated block comment" and its span.+chain parses, and dropping it doesn't recurse. 600 nested unary minus signs still give E_GUARD_AST_DEPTH_EXCEEDED.Stack overflow when dropping chained trees (fuzz, 45e21bd)
::,[1],.a, COLLATE, IS NULL or IN, or one mixing them with=/+, overflowed the stack while its tree was dropped, even after the depth guard had refused it. The AstNode derive now generatestake_expressions, and BinaryOp, Cast, CollationExpr, DotAccess, In, IsNull, IsTrueFalse, JsonExtractFunc, LikeOp, Subscript, UnaryOp, Alias and Between drop through one shared worklist. This replaces the BinaryOp-only worklist.+and||parse;::,=,[1],.aand=/IS NULL are refused with E_GUARD_AST_DEPTH_EXCEEDED; a::chain cut off by a syntax error is refused. Without the fix the test process aborts with a stack overflow.Auditor withholds
[ org . ] accountas a table reference, with each part quoted separately.ALTER ORGANIZATION ACCOUNT UNSET "v1 Q"keepsv1 Q.YEAR(9) TO MONTHno longer becomes a call plus a variable, andSECOND(9), (3)no longer splits into two select items.D133 (utility)
Snowflake's
WITH … AS PROCEDUREgrammar is looser than the parser allowed. Per the receipts it accepts:Quoted strings and reserved words stay refused. This clears 24 of 27 settled-accept cases. The other 3 have an invalid
LANGUAGE SQL AS 'm'body, which Snowflake reaches only after its parameter error.Each fix has a regression test that fails without it. The gate report follows in a comment.