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

   Dialects: MsSql
   
   A `RETURN` with no value read the keyword after it as a column name. `IF @f 
= 1 BEGIN RETURN END` failed with `Expected: END, found: EOF`, and with 
`require_semicolon_stmt_delimiter = false`, `IF @f = 1 RETURN` followed by 
`SELECT id FROM t` on the next line failed with `Expected: an SQL statement, 
found: id`.
   
   MsSql now parses 
[`RETURN`](https://learn.microsoft.com/en-us/sql/t-sql/language-elements/return-transact-sql)
 itself and gives it no value when the next token is a keyword that cannot be 
an implicit alias, such as `SELECT`, `SET`, `IF` or `END`, following the check 
suggested in 
https://github.com/apache/datafusion-sqlparser-rs/pull/1949#discussion_r2248618331.
 Values such as `@x`, `@@ERROR`, `SYSTEM_USER`, `(SELECT 1)`, function calls 
and `CASE` read as before, and other dialects keep the generic `RETURN`.
   
   This builds on #2991, which adds `SET`, `BEGIN` and the other statement 
keywords to the list the check reads, and its commits come first here until it 
merges.
   
   Refs #1800
   
   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]

Reply via email to