slopgobblercobbler opened a new pull request, #2790:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2790

   <!-- comma separated, or `none` -->
   Dialects: snowflake
   
   ### Description
   
   Fixes #2765.
   
   In `parse_create_database` and `parse_copy_into`, trailing option loops 
consumed tokens via `parser.next_token()` and broke on `Token::SemiColon | 
Token::EOF` without 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 1` or `COPY INTO my_table FROM @my_stage; SELECT 
1`), the semicolon had already been swallowed from the token stream, causing 
statement separation to fail with `Expected: end of statement, found: SELECT`.
   
   This change updates both loops to inspect upcoming tokens with 
`parser.peek_token()`, advancing with `advance_token()` only when consuming 
known keywords or options. Delimiters and unexpected tokens break out cleanly 
without being consumed, keeping statement separation intact.
   
   ### Tests
   - Added multi-statement separation test cases in 
`tests/sqlparser_snowflake.rs`:
     - `CREATE DATABASE my_db; SELECT 1`
     - `COPY INTO my_table FROM @my_stage; SELECT 1`
   - Verified all 168 Snowflake dialect tests pass (`cargo test --test 
sqlparser_snowflake`).
   - Verified `cargo clippy --all-targets` passes with 0 warnings.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to