cat_tools 0.2.3: fix pg_class.relkind mapping and the pg_upgrade update path#42
Merged
jnasbyupgrade merged 2 commits intoJul 20, 2026
Merged
Conversation
`relation__kind()` (relkind -> type) and `relation__relkind()` (type -> relkind), as shipped through **0.2.2**, map the `pg_class.relkind` codes `c`, `f`, and `m` **backwards**. Release a patch that fixes that.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the ⚙️ Run configurationConfiguration used: Organization UI Review profile: ASSERTIVE Plan: Pro Plus Run ID: You can disable this status message by setting the Use the checkbox below for a quick retry:
✨ Finishing Touches🧪 Generate unit tests (beta)
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. Comment |
jnasbyupgrade
force-pushed
the
reroll-023-fix
branch
7 times, most recently
from
July 20, 2026 19:46
ae6c1e0 to
9f23c59
Compare
jnasbyupgrade
force-pushed
the
reroll-023-fix
branch
from
July 20, 2026 20:19
9f23c59 to
558c738
Compare
jnasbyupgrade
added a commit
to jnasbyupgrade/cat_tools
that referenced
this pull request
Jul 20, 2026
The extension-update-test PG10 leg already exercises the pre-0.2.2 update scripts (0.2.0/0.2.1 -> 0.2.2). Add a third update-check that installs 0.2.0 on PG10 (relhasoids present in _cat_tools.pg_class_v via the buggy 0.2.0--0.2.2 omit_column no-op) and updates to 0.2.3, which routes through 0.2.2--0.2.3 and must fire the conditional rebuild that strips relhasoids. A psql assertion fails loudly if relhasoids is still present after reaching 0.2.3, explicitly verifying the rebuild on the real broken path. 0.2.3 is the furthest PG10 can reach (0.2.3--0.3.0 needs PG12+). Complements the stronger 10->18 pg_upgrade bridge leg and mirrors the relhasoids assertion going into the Postgres-Extensions#42 replication. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jnasbyupgrade
added a commit
to jnasbyupgrade/cat_tools
that referenced
this pull request
Jul 20, 2026
Match the concise 0.2.3 entry going into the Postgres-Extensions#42 replication for consistency (most HISTORY entries are at most a paragraph). The detailed scoping of the conditional view rebuild remains in the README caveat. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Correct the backwards pg_class.relkind mapping in relation__kind() and relation__relkind(). Per pg_class.h, 'c' is a composite type, 'f' a foreign table, and 'm' a materialized view; releases through 0.2.2 had these three reversed. Fix binary pg_upgrade failing for databases that reached 0.2.2 via the 0.2.0->0.2.2 or 0.2.1->0.2.2 update scripts. Those scripts filtered omitted columns with `!= ANY` instead of `!= ALL`; on a multi-element list `!= ANY` strips nothing, so catalog columns removed in newer PostgreSQL (relhasoids, relhaspkey) remained in _cat_tools.pg_class_v and made pg_upgrade to PG12+ fail. Rather than re-issue the already-published 0.2.0->0.2.2 and 0.2.1->0.2.2 scripts, the 0.2.2->0.2.3 update repairs such a database at runtime: it detects the broken build (a relhasoids column still present on _cat_tools.pg_class_v) and only then drops and recreates the public view chain (cat_tools.pg_class_v, cat_tools.column, cat_tools.pg_class()) with the corrected column list. A fresh 0.2.2 install already has correct views, so the rebuild is skipped entirely and its views -- and any objects depending on them -- are left untouched. Because the repair is DROP+CREATE without CASCADE, a database that IS repaired must have any user objects depending on those public views dropped first and recreated afterward, or the update aborts. Consequently, to binary-pg_upgrade a cluster whose cat_tools reached 0.2.2 via those update paths to PostgreSQL 12+, first ALTER EXTENSION cat_tools UPDATE to 0.2.3 (or newer); this is documented in README.asc and HISTORY.asc. Track the generated sql/cat_tools--0.2.3.sql.in install script -- the nontrivial 0.2.2->0.2.3 update warrants committing it for update-test coverage and provenance -- and update CLAUDE.md's SQL-file-tracking rule accordingly. Also adds a RELEASE.md and a test/build/upgrade.sql regression guard proving a fresh 0.2.2 install's dependent objects survive the update to 0.2.3. Verified on PostgreSQL 12 and 17 via the new test/build/upgrade.sql (a fresh 0.2.2 install with dependent views updates to 0.2.3 with those views left in place), and by master's extension-update-test (PG10), which installs 0.2.0, updates to current (0.2.0->0.2.2->0.2.3, exercising the conditional repair on a genuinely broken build), plus the explicit 0.2.1->0.2.2 leg. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jnasbyupgrade
force-pushed
the
reroll-023-fix
branch
from
July 20, 2026 20:39
558c738 to
d977bac
Compare
jnasbyupgrade
added a commit
to jnasbyupgrade/cat_tools
that referenced
this pull request
Jul 20, 2026
…stgres-Extensions#42) new_functions' HISTORY 0.2.3 entry references a README "Updating the extension" section that did not exist here; the README instead carried an ad-hoc [NOTE] in the Views section. Add the formal section VERBATIM from the Postgres-Extensions#42 reroll branch (byte-identical, same placement after "=== Supported Versions") so the HISTORY reference resolves and the two branches' READMEs match ahead of the Postgres-Extensions#16->master merge. Remove the now-redundant Views [NOTE]: its content (rebuild scope + drop-dependents-first caveat scoped to 0.2.0/0.2.1, fresh install unaffected) is fully covered by the new section, which additionally documents the pg_upgrade ordering. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jnasbyupgrade
added a commit
to jnasbyupgrade/cat_tools
that referenced
this pull request
Jul 20, 2026
…cktick identifiers) Replace the plain-text 0.2.3 entry with Postgres-Extensions#42's exact version, which backticks identifiers (`pg_class.relkind`, `relation__kind()`, `relhasoids`, `pg_class_v`, ...) per HISTORY.asc house style. The 0.2.3 block is now byte-identical between new_functions and the Postgres-Extensions#42 reroll branch. 0.3.0 entry untouched. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
jnasbyupgrade
merged commit Jul 20, 2026
2146123
into
Postgres-Extensions:master
18 of 20 checks passed
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.
Release cat_tools 0.2.3.
Correct the backwards pg_class.relkind mapping in relation__kind() and relation__relkind(). Per pg_class.h, 'c' is a composite type, 'f' a foreign table, and 'm' a materialized view; releases through 0.2.2 had these three reversed.
Fix binary pg_upgrade failing for databases that reached 0.2.2 via the 0.2.0->0.2.2 or 0.2.1->0.2.2 update scripts. Those scripts filtered omitted columns with
!= ANYinstead of!= ALL; on a multi-element list!= ANYstrips nothing, so catalog columns removed in newer PostgreSQL (relhasoids, relhaspkey) remained in _cat_tools.pg_class_v and made pg_upgrade to PG12+ fail. Rather than re-issue the already-published 0.2.0->0.2.2 and 0.2.1->0.2.2 scripts, the 0.2.2->0.2.3 update repairs such a database at runtime: it detects the broken build (a relhasoids column still present on _cat_tools.pg_class_v) and only then drops and recreates the public view chain (cat_tools.pg_class_v, cat_tools.column, cat_tools.pg_class()) with the corrected column list. A fresh 0.2.2 install already has correct views, so the rebuild is skipped entirely and its views -- and any objects depending on them -- are left untouched. Because the repair is DROP+CREATE without CASCADE, a database that IS repaired must have any user objects depending on those public views dropped first and recreated afterward, or the update aborts.Consequently, to binary-pg_upgrade a cluster whose cat_tools reached 0.2.2 via those update paths to PostgreSQL 12+, first ALTER EXTENSION cat_tools UPDATE to 0.2.3 (or newer); this is documented in README.asc and HISTORY.asc.
Track the generated sql/cat_tools--0.2.3.sql.in install script -- the nontrivial 0.2.2->0.2.3 update warrants committing it for update-test coverage and provenance -- and update CLAUDE.md's SQL-file-tracking rule accordingly. Also adds a RELEASE.md and a test/build/upgrade.sql regression guard proving a fresh 0.2.2 install's dependent objects survive the update to 0.2.3.
Verified on PostgreSQL 12 and 17 via the new test/build/upgrade.sql (a fresh 0.2.2 install with dependent views updates to 0.2.3 with those views left in place), and by master's extension-update-test (PG10), which installs 0.2.0, updates to current (0.2.0->0.2.2->0.2.3, exercising the conditional repair on a genuinely broken build), plus the explicit 0.2.1->0.2.2 leg.