You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Parser rejects column aliases that Snowflake accepts #1607
For example: SELECT cluster FROM tbl --> accepted by both Snowflake and the parser SELECT col cluster FROM tbl --> accepted by Snowflake but not by the parser SELECT col col_alias FROM tbl --> accepted by both Snowflake and the parser SELECT col AS cluster FROM tbl --> accepted by both Snowflake and the parser (this one really bakes my noodle...)
The underlying issue here is that when a column alias is provided implicitly, i.e. without the use of the AS keyword, the parser has to decide if the next word after a column ident is an alias or the beginning of some other construct that should be parsed differently.
For example: SELECT 1 LIMIT on Snowflake produces a result set with one column named limit, but the statement SELECT 1 LIMIT 5 produces a result set with one column named 1 (the limit is parsed as a limit on the number of rows in the result set).
A possible solution is to make this decision more accurate. Instead of looking at just the next word, the parser should look further ahead to identify constructs that should not be parsed as an alias.
Activity
yoavcloud commentedon Dec 26, 2024
The underlying issue here is that when a column alias is provided implicitly, i.e. without the use of the
ASkeyword, the parser has to decide if the next word after a column ident is an alias or the beginning of some other construct that should be parsed differently.For example:
SELECT 1 LIMITon Snowflake produces a result set with one column namedlimit, but the statementSELECT 1 LIMIT 5produces a result set with one column named1(the limit is parsed as a limit on the number of rows in the result set).A possible solution is to make this decision more accurate. Instead of looking at just the next word, the parser should look further ahead to identify constructs that should not be parsed as an alias.
iffyio commentedon Feb 9, 2025
Done in #1632