Add pgtle.set_extension_schema() to set an extension's schema#311
Open
jim-mlodgenski wants to merge 1 commit into
Open
Add pgtle.set_extension_schema() to set an extension's schema#311jim-mlodgenski wants to merge 1 commit into
jim-mlodgenski wants to merge 1 commit into
Conversation
Schema support added in pg_tle 1.5 stores the target schema in an extension's control function, but there was no way to set or change it afterward. An extension installed before 1.5, or with the wrong schema, could only adopt one by uninstalling and reinstalling, which drops any data in its tables. Add pgtle.set_extension_schema(name, schema), which rewrites just the control function in place. It takes the schema as text (matching install_extension's schema argument, which likewise only records the name) and accepts NULL to clear it; an empty string is rejected. The change affects future CREATE EXTENSION calls; an already-created extension is left untouched. Fixes aws#301.
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.
Issue #, if available: #301
Description of changes:
Schema support added in pg_tle 1.5 stores the target schema in an
extension's control function, but there was no way to set or change it
afterward. An extension installed before 1.5, or with the wrong schema,
could only adopt one by uninstalling and reinstalling, which drops any
data in its tables.
This change adds pgtle.set_extension_schema(name, schema), which
rewrites just the control function in place. It takes the schema as
text (matching install_extension's schema argument, which likewise only
records the name) and accepts NULL to clear it; an empty string is
rejected. The change affects future CREATE EXTENSION calls; an
already-created extension is left untouched. The new function ships in a
1.5.2--1.5.3 upgrade script, with regression coverage in
pg_tle_extension_schema and documentation in 03_managing_extensions.md.
By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.