LucaCappelletti94 opened a new pull request, #2728: URL: https://github.com/apache/datafusion-sqlparser-rs/pull/2728
`CREATE FUNCTION` rejected the [SQL-standard body that PostgreSQL 14 added](https://www.postgresql.org/docs/current/sql-createfunction.html.). `CREATE FUNCTION f() RETURNS INT LANGUAGE sql BEGIN ATOMIC SELECT 1; END` failed with `Expected: end of statement, found: BEGIN` under both `PostgreSqlDialect` and `GenericDialect`, and `pg_dump` writes SQL functions with such bodies in exactly this form. The PostgreSQL `CREATE FUNCTION` option loop now reads `BEGIN ATOMIC` and the statements up to `END`, and stores them in a new `CreateFunctionBody::BeginAtomic` variant that reuses `BeginEndStatements`. PostgreSQL writes no `AS` before the block, so a separate variant keeps it apart from the SQL Server `AS BEGIN ... END` body. A `RETURN expr;` inside the block parses as the existing `Statement::Return`. -- 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]
