-
Notifications
You must be signed in to change notification settings - Fork 3.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
112200: plpgsql: correctly handle parsing errors r=DrewKimball a=DrewKimball #### plpgsql: correctly handle parsing errors This patch ensures that PLpgSQL parsing errors are correctly propagated in all cases. Previously, there were a few cases (like variable declaration type parsing) where an error didn't halt parsing. The contract for `GetTypeFromValidSQLSyntax` is also clarified, since it is ok to call with an invalid type name as long as the error is properly handled. Informs #105254 Release note: None #### plpgsql: handle multiple expressions when one expression is expected Previously, the PLpgSQL parser could panic when the user supplied more than one expression in a location where only one was expected, for example, in a return statement. This was because the PLpgSQL parser delegated to the SQL parser's `ParseExpr` function, which expects exactly one input expression. This commit returns a syntax error instead of the panic by switching to use `ParseExprs`, which can handle multiple input expressions. Informs #109342 Release note: None #### plpgsql: return correct error for invalid parantheses and missing expression This patch fixes error messages in the PLpgSQL parser for the case when the parenthesis nesting is invalid, and for the case when no expression (or statement) is supplied. Previously, invalid parentheses would cause a panic without an error code, and a missing expression had the incorrect message, since it wasn't checked until the SQL parser attempted to read an empty string. Now, both cases are checked immediately by the PLpgSQL parser and the correct error is propagated. Fixes #109342 Release note: None Co-authored-by: Drew Kimball <[email protected]>
- Loading branch information
Showing
9 changed files
with
323 additions
and
81 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.