aharpervc opened a new pull request, #1808: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/1808
For reference: https://learn.microsoft.com/en-us/sql/t-sql/statements/create-function-transact-sql?view=sql-server-ver16 In SQL Server, functions look a lot like procedures, with begin/end, multiple statements, and a return. To accommodate that here in the parser, a `MultiStatement` function body type is introduced along with a `RETURN` statement type. Then also while I was working on this, I noticed that only SQL Server (so far...?) supports `OR ALTER`, so I introduced a new struct field to track that. (Again, very similar to `CREATE PROCEDURE` logic). I'm not aiming to enable parsing every function type here in this PR -- just trying to get something operational, and the additional capabilities like table expressions, etc, can be added in later. --- Also while I was here, I noticed that both these new multi statement functions & the existing procedure parsing fails unless the statements are semi-colon delimited. Semi-colons are optional in SQL Server, so for example, this code executes fine for real but fails to parse here in this library, unless that "SET" ends with a `;`... ```mssql CREATE OR ALTER PROCEDURE test (@foo INT, @bar VARCHAR(256)) AS BEGIN SET @foo = @foo + 1 SELECT @foo END ``` I think this is because the procedure body parsing logic is using `parse_statements()`, which requires it? I'm game to tackle the problem with some guidance on what's a good approach to make it parse 🤔 -- 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: github-unsubscr...@datafusion.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: github-unsubscr...@datafusion.apache.org For additional commands, e-mail: github-h...@datafusion.apache.org