Fix uninstall_extension dropping prefix-named sibling extensions - #319
Open
jim-mlodgenski wants to merge 2 commits into
Open
Fix uninstall_extension dropping prefix-named sibling extensions#319jim-mlodgenski wants to merge 2 commits into
jim-mlodgenski wants to merge 2 commits into
Conversation
uninstall_extension() matched the functions to drop with LIKE patterns of
the forms <extname>%.control and <extname>%.sql. Because the % immediately
follows the name, the patterns also matched any other extension whose name
has <extname> as a prefix, so uninstalling 'foo' silently dropped the
registration of 'foo_bar'. Names may also contain '_' (a LIKE wildcard),
and uninstall_extension('') matched every extension's control function.
Match the control function by exact name and the script functions with an
anchored, metacharacter-escaped regular expression, delivered as a new
1.5.2 -> 1.5.3 upgrade script that replaces both uninstall_extension
overloads.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
…fix stale functions_acl line numbers
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.
Supersedes #314 (rebased onto current
mainto resolve a conflict; #314's source branch lives on a fork we can't push to). Original work by @jnasbyupgrade.What this does
pgtle.uninstall_extension()located registration functions to drop usingLIKE '<extname>%.control'/'<extname>%.sql'patterns. Because%immediately follows the name, the patterns also matched artifacts of any other extension whose name has<extname>as a prefix — so uninstallingfoosilently droppedfoo_bartoo._(aLIKEwildcard) widened the over-match further, anduninstall_extension('')matched%.controland tried to drop every registered extension.Fix:
<extname>.control).--separator (^<ext>--...\.sql$), regex-escaping the name/version so metacharacters are literal. This also lets the two-arg form express "version is one of the---delimited tokens" precisely (removing a latent1.1vs1.10over-match).Delivered in the (unreleased)
1.5.2 -> 1.5.3upgrade script, alongsideset_extension_schema(#311).Conflict resolution vs #314
pg_tle--1.5.2--1.5.3.sql(1.5.3 is not yet tagged), rather than bumping to 1.5.4.CONTEXT ... linenumbers inpg_tle_functions_acl.out(23->29, 61->66) — the committed expected output predated the comment block added touninstall_extension(text);pg_tle_management.outwas already updated but this file was missed.Testing
make installcheckon PG 17: passes with parity tomain(the unrelatedpg_tle_extension_schemaflake reproduces on pristinemainlocally and is green in CI).Co-authored-by: jnasbyupgrade jnasby@upgrade.com