Skip to content

Structural comparison in pg-upgrade-test (both twin databases) - #38

Draft
jnasbyupgrade wants to merge 1 commit into
phase6-compare-and-reportfrom
phase6b-compare-in-pg-upgrade-test
Draft

Structural comparison in pg-upgrade-test (both twin databases)#38
jnasbyupgrade wants to merge 1 commit into
phase6-compare-and-reportfrom
phase6b-compare-in-pg-upgrade-test

Conversation

@jnasbyupgrade

Copy link
Copy Markdown
Contributor

Supersedes #35, which is now stale: it was branched before pg-upgrade-test's twin-database redesign (the schema matrix axis was removed and replaced with a single job that prepares two databases - count_nulls_upgrade_none (schema none) and count_nulls_upgrade_quoted (schema Quoted) - ahead of one binary pg_upgrade call, then loops bin/test_existing's update/run-suite over both). #35 referenced matrix.schema and a single count_nulls_upgrade database name that no longer exist in that form.

This PR adapts #35's actual intent to the new shape:

  • Adds an EXISTING_DB argument back to bin/compare_fresh_vs_update (it doesn't exist on phase6-compare-and-report's current version - both branches independently added this script, and only Run bin/compare_fresh_vs_update against the real pg_upgraded database too #35's version had this parameter). When given, the script diffs that already-populated database against a fresh install instead of creating+updating its own scratch database, and leaves it untouched on exit (only scratch databases it created itself are dropped).
  • Adds a step after the existing "Run the suite against the pg_upgraded database" step in pg-upgrade-test that loops the comparison over both twin databases, each against a fresh install in its own schema:
    • bin/compare_fresh_vs_update "" 0.9.6 count_nulls_upgrade_none
    • bin/compare_fresh_vs_update Quoted 0.9.6 count_nulls_upgrade_quoted

This catches a divergence class the fixed pgTAP suite doesn't: an object left subtly different (body, comment, ACL) by surviving a real binary catalog migration, as opposed to only an in-place ALTER EXTENSION UPDATE (which extension-update-test already covers with the same tool).

Verification

This container's PG12/PG17 clusters are shared persistent dev infra, not disposable, so a real pg_upgrade between them wasn't run. Instead, verified the mechanics against plain (non-upgraded) databases with the same names/schemas the CI job produces:

  • bin/test_existing prepare-old for both count_nulls_upgrade_none (schema "") and count_nulls_upgrade_quoted (schema Quoted)
  • bin/test_existing update + run-suite for both - both pass
  • bin/compare_fresh_vs_update "" 0.9.6 count_nulls_upgrade_none and the Quoted equivalent - both report IDENTICAL and exit 0
  • Negative check: COMMENT ON FUNCTION ... on one of the existing databases, re-ran the comparison - it correctly printed a real diff and exited nonzero, then reverted and confirmed it passes clean again
  • Confirmed the EXISTING_DB databases survive the comparison script (only its own scratch compare_fresh_vs_update_* databases are dropped)

The real binary pg_upgrade leg itself is left for CI's ephemeral containers.

@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: 18e75e19-7b5d-4b28-b1bd-deb5b262f3e3

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 title Phase 6b: structural comparison in pg-upgrade-test (both twin databases) Structural comparison in pg-upgrade-test (both twin databases) Aug 4, 2026
@github-actions

github-actions Bot commented Aug 4, 2026

Copy link
Copy Markdown

Code review

No issues found. Checked for bugs and CLAUDE.md compliance.

@jnasbyupgrade
jnasbyupgrade marked this pull request as draft August 4, 2026 21:11
Adapts the intent of #35 (branched before pg-upgrade-test's twin-database
redesign, now stale) to the current job shape: prepare-old/update/run-suite
already loop bin/test_existing over count_nulls_upgrade_none (schema "")
and count_nulls_upgrade_quoted (schema Quoted) sharing one binary pg_upgrade
call. Adds an EXISTING_DB argument to bin/compare_fresh_vs_update so it can
structurally diff an already-populated database (the real pg_upgraded one)
against a fresh install, instead of only ever creating its own scratch
"updated" database - then loops that comparison over both databases/schemas
after run-suite, same as extension-update-test already does for its own
in-place update leg.
@jnasbyupgrade
jnasbyupgrade force-pushed the phase6b-compare-in-pg-upgrade-test branch from 8f0a273 to e74ffc6 Compare August 4, 2026 23:17
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