Skip to content

Real update path: recover 0.1.1, author 0.1.1→stable diff (depends on #26 for the stable rename) - #22

Draft
jnasbyupgrade wants to merge 3 commits into
rename-1.0.0-to-stablefrom
real-update-path
Draft

Real update path: recover 0.1.1, author 0.1.1→stable diff (depends on #26 for the stable rename)#22
jnasbyupgrade wants to merge 3 commits into
rename-1.0.0-to-stablefrom
real-update-path

Conversation

@jnasbyupgrade

@jnasbyupgrade jnasbyupgrade commented Aug 4, 2026

Copy link
Copy Markdown
Contributor

Migrated from fork-internal PR jnasbyupgrade#7 to enable a native same-repo stacked PR (bases off test-install-foundation, which now exists directly on Postgres-Extensions/extension_tools). Original PR: jnasbyupgrade#7


Update: This PR previously also did the default_version rename (1.0.0 -> stable) inline. That's been split out into #26 at the owner's request, since it's a separate, independently-mergeable concern (pure versioning/docs) from the update-path testing infrastructure below. This PR's base is now rename-1.0.0-to-stable (#26's branch) instead of test-install-foundation directly, since the update-path testing work here genuinely depends on both: the test/install/ harness from test-install-foundation (#19) and the stable rename from #26 (the update-diff script's target, and what bin/test_update_path.sh asserts the version lands at). Since rename-1.0.0-to-stable branches off fix-cat-tools-install as a sibling of test-install-foundation rather than stacking under it, this PR's "Files changed" tab will show test-install-foundation's own files too until #19 merges (a GitHub diff-scoping artifact of depending on two sibling branches at once, not new/duplicated content) -- it no longer shows any default_version/HISTORY.asc/META changes, since those now live solely in #26.

Summary

extension_drop's real 0.1.1 install script (2017, its only actual PGXN
release) was never committed to this repo -- only ever generated as a
build artifact and uploaded directly to PGXN. As a result, no update-diff
script has ever existed either, despite a real SQL change between 0.1.1
and the current stable source (the client_min_messages removal in
HISTORY.asc). Anyone who actually installed 0.1.1 from PGXN had, and
until this PR merges still has, no ALTER EXTENSION UPDATE path forward
at all.

This is real, valuable, buildable-right-now work -- it does not depend on
cat_tools shipping a real PGXN 0.3.0, or on this extension being formally
released. It only rides on this branch stack because CI needs cat_tools
installed from git-source (already solved by the base of this stack)
rather than PGXN, and because it needs the stable rename (#26) to know
what to update to.

What's in this PR

  • Recovered the real 0.1.1 install script from PGXN's dist archive:
    https://api.pgxn.org/dist/extension_drop/0.1.1/extension_drop-0.1.1.zip
    (URL confirmed working, confirmed against
    https://api.pgxn.org/dist/extension_drop.json). Committed byte-for-byte
    as sql/extension_drop--0.1.1.sql. Added DATA += sql/extension_drop--0.1.1.sql
    to the Makefile -- pgxntool's base.mk DATA wildcard only picks up the
    current version file plus two-dash update scripts, not other historical
    single-version files (already filed as Postgres-Extensions/pgxntool#48).

  • The actual delta, found by diffing recovered 0.1.1 against current
    sql/extension_drop.sql
    , turned out to be three things, only one of
    which needs replaying in an update script:

    1. extension_drop__event_trigger() gained one RAISE DEBUG line at
      entry -- a real, persisted function body change. This is the only
      thing sql/extension_drop--0.1.1--stable.sql does
      (a single
      CREATE OR REPLACE FUNCTION).
    2. The client_min_messages save/restore removal HISTORY.asc already
      documents -- but that code only ever ran inside the install script's
      own session and never left anything in the extension's persisted
      state, so an already-installed 0.1.1 has nothing to clean up here.
    3. A cat_tools function rename (function__arg_types_text ->
      routine__parse_arg_types_text, not previously documented in
      HISTORY.asc
      -- found via git log -S on sql/extension_drop.sql,
      landed in the "Fix misnamed function call" part of Switch to GitHub Actions and update pgxntool #1) -- but that
      call only happens transiently inside the install script's internal
      __extension_drop.create_function() builder to compute REVOKE/GRANT
      argument lists; it's never stored in any persisted function body, so
      it doesn't affect an already-installed 0.1.1 either. (Also: cat_tools
      0.3.0 keeps the old name as a deprecated wrapper, so a fresh CREATE EXTENSION extension_drop VERSION '0.1.1' still works today for
      testing this exact path.)
  • default_version rename (1.0.0 -> stable) now lives in Rename default_version from 1.0.0 to stable #26, not
    here -- see that PR for details. This PR's update-diff script
    (sql/extension_drop--0.1.1--stable.sql) and bin/test_update_path.sh
    both depend on it having landed.

  • Wired up a real, CI-exercised update-path leg. TEST_UPDATE_FROM
    now defaults to 0.1.1 (previously required explicitly, with no safe
    default, since there was nothing real to point it at). Added
    bin/test_update_path.sh, a committed/parameterized script (not inline
    YAML) that: installs 0.1.1, plants the dependency-guard view, proves a
    non-CASCADE DROP EXTENSION is blocked, runs ALTER EXTENSION extension_drop UPDATE, re-proves the guard still blocks the drop, and
    dynamically asserts (empty-value-guarded, not hardcoded) that the
    installed version now matches extension_drop.control's
    default_version. The new extension-update-test CI job runs this
    script, then make test-update to run the full pgTAP suite (including
    dependency_guard) against the updated result.

    This job runs as a single job on PG17 rather than a second full PG
    matrix: extension_drop's install/update scripts have nothing
    catalog-version-sensitive in them (no pg_upgrade/omit_column-style
    concerns), so it's a PG-version-agnostic, SQL-level concern layered onto
    the matrix approach the rest of this stack already uses, not something
    that needs its own axis.

Local verification (PG17, this container)

$ bin/test_update_path.sh
...
OK (pre-update, at 0.1.1): non-CASCADE DROP EXTENSION extension_drop is blocked by the dependency guard
OK (post-update): non-CASCADE DROP EXTENSION extension_drop is blocked by the dependency guard
OK: extension_drop landed at 'stable' after update, matching extension_drop.control's default_version
PASS: 0.1.1 -> stable update path verified (install, guard survival, version assertion).

$ make test-update    # full pgTAP suite in update mode
ok 1 - ../install/load
ok 2 - dependency_guard
ok 3 - schema
ok 4 - simple
ok 5 - zzz_build
# All 5 tests passed.

$ make test           # fresh mode, unaffected
# All 5 tests passed.

Test plan

  • Locally: install 0.1.1 -> ALTER EXTENSION UPDATE -> lands at
    stable -> dependency guard survives -> full pgTAP suite passes
    (update mode)
  • Locally: fresh install (now landing at stable) still passes the
    full suite
  • CI: existing test matrix (fresh install, PG 9.3-17) stays green
  • CI: new extension-update-test job passes

@coderabbitai

coderabbitai Bot commented Aug 4, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Organization UI

Review profile: ASSERTIVE

Plan: Pro Plus

Run ID: 5bc172b0-e786-49b2-9df3-936e6cbd6c12

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@jnasbyupgrade
jnasbyupgrade changed the base branch from test-install-foundation to rename-1.0.0-to-stable August 4, 2026 22:53
@jnasbyupgrade jnasbyupgrade changed the title Real update path: recover 0.1.1, author 0.1.1→stable diff, rename 1.0.0→stable Real update path: recover 0.1.1, author 0.1.1→stable diff (depends on #26 for the stable rename) Aug 4, 2026
jnasbyupgrade and others added 3 commits August 4, 2026 18:12
…, quoting-requiring schema test

Builds the U&U (update & upgrade) test infrastructure that doesn't require a
real second extension_drop version or pg_upgrade CI to already exist:

- PGXNTOOL_ENABLE_TEST_INSTALL = yes, with test/install/load.sql as the
  committed-once installer for the extension (no test roles exist for this
  extension, so unlike cat_tools there's nothing role-related to add).
- TEST_LOAD_SOURCE (fresh/update/existing) GUC/make-var switch, parse-time
  validated, exported unconditionally, read in load.sql without missing_ok.
  `existing` mode is fully exercised locally (verified against a real,
  already-installed database, including the failure path when the extension
  is genuinely absent). `update` mode is wired up and structurally verified
  end-to-end, but extension_drop has no real prior released version to
  update FROM yet -- the Makefile refuses to run it without TEST_UPDATE_FROM
  set explicitly, and no CI leg exercises it in this repo today.
- Dependency guard (test/sql/dependency_guard.sql): a view depending on
  extension_drop__commands' row type blocks a non-CASCADE DROP EXTENSION;
  proven by actually attempting the drop and asserting failure, not assumed.
- test/sql/schema.sql's custom-schema test names renamed to mixed case
  (requires identifier quoting), reusing its existing coverage rather than
  adding a new schema-testing dimension.
- ci.yml: run `make test && make verify-results` instead of pg-build-test,
  so a real regression actually fails the build (pgxntool's
  .IGNORE: installcheck otherwise reports green regardless of test results,
  per RELEASE.md's existing note about PRs #6/#7).

Moving the extension's own installation into test/install/load.sql required
adapting every test file that used to install it per-test in a rolled-back
transaction (test/deps.sql, test/sql/simple.sql, test/sql/schema.sql,
test/sql/zzz_build.sql) to work against the new committed-once install
instead, since an extension name is a database-wide singleton.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
…redate this branch

CI on this branch showed the switch to `make test && make verify-results`
surfacing real pgTAP failures on PostgreSQL 9.3/9.6 (cat_tools/extension_drop
never actually install there). Checked PR #10's own baseline CI
(#10, run
30665031257): PG 9.3 and 9.6 already report "3 of 3 tests failed" in the raw
job log there too, just silently reported as a passing check because
pg-build-test's underlying `make test` hits pgxntool's
`.IGNORE: installcheck` the same way. So this isn't a regression from this
PR's own changes -- it's the exact masking problem RELEASE.md already
documents, just now applying to a different, older part of the PG matrix
than the PRs (#6/#7) it originally cites. Reverting the ci.yml step back to
pg-build-test here keeps this PR scoped to test/install infrastructure;
fixing cat_tools's install path on pre-PG10 belongs to whoever owns that
dependency setup (PR #10 or a follow-up), not this PR.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
extension_drop's real 0.1.1 install script (2017) was never committed to
this repo -- only ever generated as a PGXN dist build artifact and
uploaded directly -- so no update-diff script has ever existed either,
despite a real SQL change between 0.1.1 and the current `stable` source
(removing redundant client_min_messages handling; see #24, which renamed
default_version from the never-released "1.0.0" to `stable` and is a
prerequisite for this branch). That left anyone who actually installed
0.1.1 from PGXN with no path forward at all.

- Recover the real 0.1.1 sql/extension_drop.sql from PGXN's dist archive
  (https://api.pgxn.org/dist/extension_drop/0.1.1/extension_drop-0.1.1.zip)
  and commit it as sql/extension_drop--0.1.1.sql. Add it to DATA
  explicitly (pgxntool's DATA wildcard only picks up the current version
  file and two-dash update scripts, not other historical single-version
  files -- Postgres-Extensions/pgxntool#48).
- Author sql/extension_drop--0.1.1--stable.sql: the actual delta is just
  extension_drop__event_trigger() gaining one RAISE DEBUG line (found by
  diffing recovered 0.1.1 against current source). The client_min_messages
  removal and a cat_tools function rename (function__arg_types_text ->
  routine__parse_arg_types_text) both turned out to be install-script-only
  behavior with nothing persisted to replay.
- Default TEST_UPDATE_FROM to 0.1.1 and wire up a real
  extension-update-test CI job: installs 0.1.1, plants the dependency
  guard, runs ALTER EXTENSION UPDATE, re-proves the guard survived,
  dynamically asserts the version landed at stable, then runs the pgTAP
  suite in update mode. Factored into bin/test_update_path.sh so it's
  runnable locally, not just inline CI YAML.

Verified locally against PG17: 0.1.1 install -> guard blocks non-CASCADE
drop -> ALTER EXTENSION UPDATE -> guard still blocks drop -> version
lands at 'stable' -> full pgTAP suite passes in both fresh and update
modes.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant