Exclude schemas owned by extensions #127
Merged
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.
Description
Exclude schemas owned by extensions.
Example:
pg_repack creates a schema called pg_repack. Let's say the user's
model.sql
removes theCREATE EXTENSION pg_repack
line. This will generate two statements:The first line drops the pg_repack schema as well because it is owned by the extension, causing the second line to fail. As a result, we should stop generating statements for schemas owned by extensions, just like we do with other schema objects.
Motivation
Bug fix
Testing
There are few extensions that actually create extensions. One is pg_repack but it doesn't come with the default set of extensions in postgres-contrib. As a result, I just tested locally by creating
pg_repack
an