-
Notifications
You must be signed in to change notification settings - Fork 926
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
Don't capture hard errors in with-clause parser #7893
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #7893 +/- ##
==========================================
+ Coverage 80.06% 81.90% +1.83%
==========================================
Files 190 249 +59
Lines 37181 46154 +8973
Branches 9450 11573 +2123
==========================================
+ Hits 29770 37801 +8031
- Misses 2997 3790 +793
- Partials 4414 4563 +149 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
a55c32a
to
d724332
Compare
7fc20c2
to
fe5e185
Compare
fe5e185
to
fc706ec
Compare
fc706ec
to
eb1d453
Compare
eb1d453
to
f476732
Compare
f476732
to
c028577
Compare
@@ -161,12 +161,38 @@ parse_arg(WithClauseDefinition arg, DefElem *def) | |||
|
|||
Assert(OidIsValid(in_fn)); | |||
|
|||
/* |
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.
Can you explain why all this pg_try-catch thing is needed?
I am asking because it looks like we are either rethrowing the error or just replacing it with another one. So why don't we just let the function call fail with whatever error it is throwing without capturing it?
Is it because we want to rewrite the error to something more user-friendly? I am wondering why we need to rewrite the error.
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.
AFAICT, it was only added for rewriting the error to something more user-friendly (see 3ef6732).
9a53848
to
da5e7b2
Compare
da5e7b2
to
1fa1462
Compare
When parsing WITH clause arguments for ALTER TABLE to extract compression parameters, syntax errors in the text format are caught using PG_TRY and PG_CATCH and then returning an indication if the parse succeeded or not. If an out-of-memory error occurs inside execution of the input function and this error is caught, it can continue executing and potentially cause cascading out-of-memory errors and in the end exhausting the error stack. This commit solves this by using checking the category of the thrown error and only allow errors in the data exception and the syntax errors and access rules violation category, which are "soft" errors in this case. Hard errors, like out-of-memory errors, are re-thrown allowing the backend to deal with it properly. It also adds tests and test utilities that allow you to raise an error of an arbitrary category when converting a string to the type.
1fa1462
to
5c62687
Compare
When parsing WITH clause arguments for ALTER TABLE to extract compression parameters, syntax errors in the text format are caught using PG_TRY and PG_CATCH and then returning an indication if the parse succeeded or not.
If an out-of-memory error occurs inside execution of the input function and this error is caught, it can continue executing and potentially cause cascading out-of-memory errors and in the end exhausting the error stack.
This commit solves this by using checking the category of the thrown error and only allow errors in the data exception and the syntax errors and access rules violation category, which are "soft" errors in this case. Hard errors, like out-of-memory errors, are re-thrown allowing the backend to deal with it properly.