-
Notifications
You must be signed in to change notification settings - Fork 3.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
release-23.2: plpgsql: correctly handle parsing errors #112508
Merged
DrewKimball
merged 3 commits into
release-23.2
from
blathers/backport-release-23.2-112200
Oct 17, 2023
Merged
release-23.2: plpgsql: correctly handle parsing errors #112508
DrewKimball
merged 3 commits into
release-23.2
from
blathers/backport-release-23.2-112200
Oct 17, 2023
Conversation
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 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
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
…ression 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
blathers-crl
bot
added
the
blathers-backport
This is a backport that Blathers created automatically.
label
Oct 17, 2023
blathers-crl
bot
force-pushed
the
blathers/backport-release-23.2-112200
branch
from
October 17, 2023 04:53
04fc528
to
d264a41
Compare
blathers-crl
bot
force-pushed
the
blathers/backport-release-23.2-112200
branch
from
October 17, 2023 04:53
cbaa87f
to
16e9564
Compare
blathers-crl
bot
requested review from
DrewKimball,
mgartner and
rharding6373
October 17, 2023 04:53
Thanks for opening a backport. Please check the backport criteria before merging:
If some of the basic criteria cannot be satisfied, ensure that the exceptional criteria are satisfied within.
Add a brief release justification to the body of your PR to justify this backport. Some other things to consider:
|
blathers-crl
bot
added
the
backport
Label PR's that are backports to older release branches
label
Oct 17, 2023
mgartner
approved these changes
Oct 17, 2023
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
backport
Label PR's that are backports to older release branches
blathers-backport
This is a backport that Blathers created automatically.
O-robot
Originated from a bot.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Backport 3/3 commits from #112200 on behalf of @DrewKimball.
/cc @cockroachdb/release
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 withan 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 inputexpression. 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
Release justification: Bug fix for new features