fix(snowflake): accept column list after CREATE DYNAMIC TABLE options#90
Merged
Merged
Conversation
…BLE options
Snowflake allows the column-definition list to appear after the options
header (TARGET_LAG / WAREHOUSE / REFRESH_MODE / INITIALIZE) rather than
before it:
CREATE OR REPLACE DYNAMIC TABLE t
TARGET_LAG = '...' WAREHOUSE = wh REFRESH_MODE = AUTO INITIALIZE = ON_CREATE
( "col" TIMESTAMP_NTZ(9), "id" VARCHAR(256), ... )
AS SELECT ...
This previously failed with "Expected end of statement, found: <TYPE>"
for two reasons:
- The bare-word option value (e.g. INITIALIZE = ON_CREATE) was parsed
with parse_expr, which greedily treated the following column-list `(`
as a function call on the value word. Bare-word option values are now
parsed as a plain identifier so the `(` is left for the column list.
- Nothing picked up a column list appearing after the options loop. The
up-front parse_columns() ran before the options and saw the first
option keyword, not `(`. A new arm in the options loop parses the
column list when it follows the options.
Both the `( ... ) AS SELECT` and column-list-only forms are covered, as
is the no-whitespace `"col"TYPE` form generators emit.
Claude-Session: https://claude.ai/code/session_012hHZLhjkLPneyPz7jpMWFS
Corpus Parsing ReportTotal: 191713 passed, 1920 failed (99.0% pass rate) ✨ No changes in test results By Dialect
|
grasskode
approved these changes
Jun 18, 2026
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.
Summary
Snowflake permits the column-definition list to appear after the options header (
TARGET_LAG/WAREHOUSE/REFRESH_MODE/INITIALIZE) rather than before it. This form is what generator-emitted dynamic-table DDL uses, and it previously failed to parse withExpected end of statement, found: <TYPE>.Root cause
Two issues, both in
parse_create_table:INITIALIZE = ON_CREATE) was parsed withparse_expr, which greedily treated the trailing column-list(as a function call on the value word — swallowingON_CREATE ( "col" TYPE, ... ). Bare-word option values are now parsed as a plain identifier so the(is left intact.parse_columns()runs before the options and saw the first option keyword, not(. A new arm in the options loop parses the column list when it follows the options.Coverage
New tests cover: column list +
AS SELECT, column-list-only (noAS), the no-whitespace"col"TYPEform, and the typesTIMESTAMP_NTZ/TIMESTAMP_TZ/NUMBER/VARCHAR/DATE/BOOLEAN. Full suite green (1187 tests); corpus run shows 0 regressions.https://claude.ai/code/session_012hHZLhjkLPneyPz7jpMWFS