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

   `Parser::parse_statements` stopped at a bare `END` wherever it expected a 
statement delimiter and returned without an error, so everything after it was 
silently dropped. In most dialects, PostgreSQL included, `SELECT 1 END; DROP 
TABLE users` came back as a single `SELECT 1`. PostgreSQL accepts `SELECT 1 
END` with `END` as a column alias and runs both statements, so a (pretty daft) 
tool checking the parsed statements never sees the `DROP`.
   
   The arm dates from when `CREATE PROCEDURE` bodies were parsed through a 
nested `parse_statements` call. Every `BEGIN ... END` body is now parsed by 
`parse_statement_list` or `parse_conditional_statements`, which consume their 
own `END`, so the arm only fired on top-level input. I removed it, and such 
input now fails with `Expected: end of statement, found: END`.
   
   Accepting `END` as a bare alias in PostgreSQL is #2491, which I will 
re-review now.


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