Repository navigation
Refuse a PostgreSQL DO block instead of modelling it as though it had not run - #294
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
Since sqlparser #2618 parses PostgreSQL's
DO, a document holding aDOblock no longer fails to parse. The statement fell into the catch-all arm ofapply_statements, soParserDBaccepted the document and modelled it as if the block had never run. A block that creates a role, or runsCREATE TABLEthroughEXECUTE, left the model without that role or table and raised no error, and any comparison against a live catalog read the gap as drift.What a
DOblock creates usually depends on the database it runs in, throughIF NOT EXISTSchecks onpg_roles,EXCEPTION WHEN duplicate_objecthandlers or dynamicEXECUTE. The model cannot know that state, soapply_statementsnow refuses everyDOblock withError::UnsupportedDoBlock, which carries the statement as written. Blocks that only touch data are refused as well, which keeps the rule simple and matches what callers saw before sqlparser parsedDO.Both lock files move to sqlparser
ebb8b04a, the first revision withStatement::Do.