Repository navigation
Snowflake: Fix CREATE DATABASE and COPY INTO consuming semicolon delimiter - #2790
slopgobblercobbler wants to merge 1 commit into
Conversation
|
Thank you for the contribution. The change may well be correct, but I am closing this PR under the DataFusion AI policy, which also applies to sqlparser-rs: https://datafusion.apache.org/contributor-guide/ai-policy.html#what-is-an-ai-dump-and-why-it-is-not-helpful Maintainer review time is the scarcest resource in this project. This account has recently opened many AI-generated PRs across many repositories. That suggests the changes aren't coming from someone who uses sqlparser-rs, and that no human will be around to discuss review feedback and maintain the code. Reviewing PRs like this costs us more time than it saves. If you do use sqlparser-rs and this fix matters to you, please pick the one change you care most about. Then open a focused PR with a short description in your own words, one you have reviewed and understand, and we'd be happy to help with review. |
Dialects: snowflake
Description
Fixes #2765.
In
parse_create_databaseandparse_copy_into, trailing option loops consumed tokens viaparser.next_token()and broke onToken::SemiColon | Token::EOFwithout restoring the consumed token. As a result, when either statement was followed by a delimiter;in a multi-statement query (e.g.CREATE DATABASE my_db; SELECT 1orCOPY INTO my_table FROM @my_stage; SELECT 1), the semicolon had already been swallowed from the token stream, causing statement separation to fail withExpected: end of statement, found: SELECT.This change updates both loops to inspect upcoming tokens with
parser.peek_token(), advancing withadvance_token()only when consuming known keywords or options. Delimiters and unexpected tokens break out cleanly without being consumed, keeping statement separation intact.Tests
tests/sqlparser_snowflake.rs:CREATE DATABASE my_db; SELECT 1COPY INTO my_table FROM @my_stage; SELECT 1cargo test --test sqlparser_snowflake).cargo clippy --all-targetspasses with 0 warnings.