Repository navigation
Error on a trailing END instead of dropping the rest of the input - #2838
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #2838 +/- ##
=======================================
Coverage 83.16% 83.16%
=======================================
Files 42 42
Lines 36420 36417 -3
Branches 36420 36417 -3
=======================================
- Hits 30287 30286 -1
+ Misses 2636 2635 -1
+ Partials 3497 3496 -1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Contributor
Author
|
Thank you for the PR @s5dsn-eqee, I will be merging it now. cc @alamb |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Parser::parse_statementsstopped at a bareENDwherever 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 userscame back as a singleSELECT 1. PostgreSQL acceptsSELECT 1 ENDwithENDas a column alias and runs both statements, so a (pretty daft) tool checking the parsed statements never sees theDROP.The arm dates from when
CREATE PROCEDUREbodies were parsed through a nestedparse_statementscall. EveryBEGIN ... ENDbody is now parsed byparse_statement_listorparse_conditional_statements, which consume their ownEND, so the arm only fired on top-level input. I removed it, and such input now fails withExpected: end of statement, found: END.Accepting
ENDas a bare alias in PostgreSQL is #2491, which I will re-review now.