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

   <!-- comma separated, or `none` -->
   Dialects: mysql, generic
   
   ### Description
   
   Fixes #2764.
   
   In `parse_flush`, the `FLUSH TABLES` loop previously consumed tokens 
unconditionally via `self.next_token()`. On the break condition (such as 
reaching a semicolon or EOF), the token was not restored with `prev_token()`. 
Consequently, when `FLUSH TABLES;` was immediately followed by another 
statement in a multi-statement query, the semicolon delimiter had already been 
consumed and was lost to the outer parser, resulting in `Expected: end of 
statement, found: <TOKEN>`.
   
   This PR switches the `TABLES` loop to inspect tokens via 
`self.peek_token()`, advancing only when matching valid options (`WITH` or 
`FOR`), so statement delimiters and EOF are preserved cleanly.
   
   ### Tests
   - Added `parse_flush_tables_followed_by_statement` in 
`tests/sqlparser_mysql.rs` covering:
     - `FLUSH TABLES; SELECT 1`
     - `FLUSH TABLES t1, t2; SELECT 1`
     - `FLUSH TABLES WITH READ LOCK; SELECT 1`
     - `FLUSH TABLES t1, t2 WITH READ LOCK; SELECT 1`
     - `FLUSH TABLES t1, t2 FOR EXPORT; SELECT 1`
   - Verified all MySQL and library unit tests pass locally (`cargo test 
--all-features`).
   - Verified `cargo clippy --all-features -- -D warnings` and `cargo fmt 
--check` are clean.
   


-- 
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