Skip to content

Snowflake ALTER SESSION cannot be followed by other statements. #1775

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
romanb opened this issue Mar 24, 2025 · 0 comments · Fixed by #1786
Closed

Snowflake ALTER SESSION cannot be followed by other statements. #1775

romanb opened this issue Mar 24, 2025 · 0 comments · Fixed by #1786

Comments

@romanb
Copy link
Contributor

romanb commented Mar 24, 2025

It seems that Snowflake ALTER SESSION statements cannot currently be followed by other statements. For example:

ALTER SESSION SET QUERY_TAG='tag'; SELECT 42

yields

Expected: another option, found: SELECT at Line: 1, Column: 36
romanb pushed a commit to romanb/datafusion-sqlparser-rs that referenced this issue Mar 31, 2025
Fixes apache#1775.

Currently parse_session_options does not check for semicolons, which
makes it impossible to parse multiple statements, where a statement
comes after ALTER SESSION.

Furthermore, it seems we should not advance the parser onto the
semicolon as it is otherwise skipped in the next loop iteration
of parse_statements() where the parser advances to the next token,
which would then result in "Expected end of statement".
romanb pushed a commit to romanb/datafusion-sqlparser-rs that referenced this issue Mar 31, 2025
Fixes apache#1775.

Currently parse_session_options does not check for semicolons, which
makes it impossible to parse multiple statements, where a statement
comes after ALTER SESSION.

Furthermore, it seems we should not advance the parser onto the
semicolon as it is otherwise skipped in the next loop iteration
of parse_statements() where the parser advances to the next token,
which would then result in "Expected end of statement".
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant