yoabot-droid opened a new pull request, #2232:
URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2232

   Two issues were blocking the `tsql()` dialect from parsing multi-statement 
scripts that use newline delimiters instead of semicolons:
   
   ### 1. Implicit alias disambiguation
   
   Keywords that begin T-SQL statements (`DECLARE`, `EXEC`/`EXECUTE`, `INSERT`, 
`UPDATE`, `DELETE`, `DROP`, `CREATE`, `ALTER`, `TRUNCATE`, `PRINT`, `WHILE`, 
`RETURN`, `THROW`, `RAISERROR`, `MERGE`) were being consumed as implicit 
aliases for the preceding `SELECT` item or table reference. Added them to both 
`is_select_item_alias()` and `is_table_factor_alias()` in `MsSqlDialect` so 
they are never treated as implicit aliases.
   
   ### 2. `EXEC (@sql)` – dynamic SQL execution
   
   `parse_execute()` was attempting to consume a second parameter list after 
already parsing the parenthesised expression name, causing parse failures on 
tokens that immediately followed the `EXEC` statement. Fixed by detecting that 
the name was itself wrapped in parens and skipping the parameter-list parse in 
that case.
   
   ### Test
   
   Adds `test_tsql_multi_statement_with_xml_nodes` covering a realistic 
multi-statement script that exercises `DECLARE`/`SET` chains, XML variable 
assignment, `SELECT … INTO #temp`, `EXEC (@sql)`, `DROP TABLE`, and plain 
`SELECT` statements.


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