Snowflake: parse EXCLUDE column list as ObjectName to support qualified names#2244
Merged
yoavcloud merged 3 commits intoapache:mainfrom Feb 27, 2026
Merged
Conversation
When a user writes `f.* EXCLUDE (f.col)` instead of `f.* EXCLUDE (col)`,
the parser previously consumed only the table qualifier (e.g. `f`) as the
identifier and then hit the `.` unexpectedly, producing a confusing error
like "Expected: `,` or `)`, found `.`".
This commit detects the qualified-name pattern in
`parse_optional_select_item_exclude` and returns an actionable error:
EXCLUDE does not support qualified column names,
use a plain identifier instead (e.g. EXCLUDE (account_canonical_id))
Applies to both the single-column (`EXCLUDE col`) and multi-column
(`EXCLUDE (col1, col2)`) forms.
Fixes repro: `SELECT f.* EXCLUDE (f.account_canonical_id, f.amount) FROM t AS f`
ed32bf3 to
2b5e911
Compare
yoavcloud
approved these changes
Feb 27, 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.
Problem
When a user writes
f.* EXCLUDE (f.account_canonical_id, f.amount), the parser was callingparse_identifier()for each entry in the EXCLUDE list. This only consumed the table qualifier (f), then hit the.and produced a confusing error:Fix
Change
ExcludeSelectItem::SingleandExcludeSelectItem::Multipleto holdObjectNameinstead ofIdent, and updateparse_optional_select_item_excludeto callparse_object_name(false)instead ofparse_identifier().This correctly handles both plain identifiers and qualified names like
f.account_canonical_id.Changes
src/ast/query.rs—ExcludeSelectItemvariants now holdObjectNamesrc/ast/spans.rs— span impl updated to useObjectName::span()src/parser/mod.rs— parser callsparse_object_name(false)sqlparser_common.rs,sqlparser_snowflake.rs,sqlparser_duckdb.rsRepro
Now parses successfully.