colinhacks opened a new pull request, #2992: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2992
Dialects: MsSql `WHILE @n < 10 SET @n = @n + 1; SELECT @n;` parsed into a single `While` whose body held both the `SET` and the `SELECT`: without `BEGIN`, `parse_while` read statements up to an `END` or the end of input. Without the final `;` the same input failed with `Expected: ;, found: EOF`. [T-SQL](https://learn.microsoft.com/en-us/sql/t-sql/language-elements/while-transact-sql) takes one statement or one `BEGIN ... END` block there. The body is now parsed as one statement unless `BEGIN` follows, so the statements after it parse on their own, and a `WHILE` with no body fails with `Expected: an SQL statement, found: EOF`. `parse_while` is shared, so this applies to every dialect; none has a body without `BEGIN` that runs to `END`. A body without `BEGIN` now displays without a trailing `;`, so a `WHILE` inside a `BEGIN ... END` list round-trips instead of printing `;;`. The `WHILE` arm of `parse_conditional_statement_block`, which no caller reached any more, is removed. Written with an AI coding assistant. -- 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]
