Repository navigation
test: native_upgrade_converge's snapshot sees defaults, indexes, constraints and row security (#1341) - #1540
Merged
Merged
Conversation
…traints and row security (#1341) @OffgridwithJD found that the catalog snapshot both twins compare could not see four kinds of upgrade drift: a column DEFAULT, a dropped UNIQUE, a dropped ENABLE ROW LEVEL SECURITY, and a policy narrowed to FOR SELECT. The query did not read pg_attrdef, index definitions, pg_constraint, relrowsecurity or pg_policy. The snapshot, identical in both twins, now also has a row per column default (pg_get_expr), index (pg_get_indexdef), constraint (pg_get_constraintdef, by schema so domain constraints count), table's row-security flags, and policy (command, permissive, roles, USING and WITH CHECK). Red first, PG17, each mutant in 1.0-alpha4--1.0-alpha5: on main all four left both twins green (shell 31/31, twin 36/36). Now each fails the four "converges" checks in both twins, and the divergence names the new row (for example "RLS|rollup_group|true|false" against "false|false"). Clean, both twins pass on PG15-19 (31/31, 12 passed), so no shipped upgrade diverges in these catalogs. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
87 tasks done
OffgridwithJD
approved these changes
Oct 19, 2026
OffgridwithJD
left a comment
Collaborator
There was a problem hiding this comment.
@jdatcmd Approving at 6cdfb51e. I measured it myself on PG17, in my own prefix copy and worktrees at 7e01d4d0 (main) and 6cdfb51e. I ran your four mutants and four of my own, all in pgcolumnar--1.0-alpha4--1.0-alpha5.sql:
| mutant | main | this head | the divergence names |
|---|---|---|---|
history_has_null … DEFAULT true |
green, both | 4 converges red in each, same names | DEF|rollup.history_has_null|false → true |
UNIQUE dropped from retired_group_pkey |
green | 4 / 4 | IDX|CREATE UNIQUE INDEX … → CREATE INDEX … |
rollup_group RLS not enabled |
green | 4 / 4 | RLS|rollup_group|true|false → false|false |
rollup_group_owner → FOR SELECT |
green | 4 / 4 | POL|…|*|… → …|r|… |
mine: FORCE ROW LEVEL SECURITY added on rollup (over-applies) |
green | 4 / 4 | RLS|rollup|true|false → true|true |
mine: rollup_owner AS RESTRICTIVE |
green | 4 / 4 | the policy's permissive true → false |
mine: retired_group_pkey columns swapped |
green | 4 / 4 | btree (storage_id, group_number) → (group_number, storage_id) |
mine: an added CHECK (deleted_count >= 0) constraint |
green | 4 / 4 | > CON|pgcolumnar.retired_group|rg_nonneg|CHECK … |
- Clean: shell 31/31 and twin 12 passed, on main and on this head.
- The query is the same in both harnesses. Compared whitespace-normalised,
SELECT 'FN|'…through thePOLarm is identical; the shell only addsORDER BY 1, and the twin sorts in Python. - Other checks:
harness_selftestPG17 rc=0, 1247 PASS;compare_to_bash0 missing; the worktree was clean after every mutant.
Non-blocking: triggers, sequences and object ownership are still outside the snapshot. Nothing in the upgrade scripts creates any of them today, as far as I can see, so I'd add them only when one appears.
🤖 Generated with Claude Code
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.
For #1341, @OffgridwithJD's finding from the review of #1536: the catalog snapshot that both
native_upgrade_convergetwins compare couldn't see four kinds of upgrade drift.What changes
The snapshot query is the same in both twins. It now also reads:
DEFpg_get_expr(adbin)IDXpg_get_indexdefUNIQUE, or changed columns or methodCONpg_get_constraintdef, by schema (so domain constraints count)RLSrelrowsecurity,relforcerowsecurityPOLpg_policy: command, permissive, roles,USING,WITH CHECKThe header comment, the twin's docstring and TESTS.md §143 now say so. No check name, test count or ledger row changes.
Measured
Red first, PG17, each mutant applied to
pgcolumnar--1.0-alpha4--1.0-alpha5.sql:7e01d4d0)history_has_null … DEFAULT trueCREATE INDEX retired_group_pkey(UNIQUEdropped)ENABLE ROW LEVEL SECURITYonrollup_groupdroppedrollup_group_ownernarrowed toFOR SELECTThe divergence names the new rows. Under the RLS mutant:
< RLS|rollup_group|true|false/> RLS|rollup_group|false|false. Under the UNIQUE mutant:< IDX|CREATE UNIQUE INDEX retired_group_pkey …/> IDX|CREATE INDEX retired_group_pkey ….Clean, on PG15, 16, 17, 18 and 19: shell 31/31, twin 12 passed. So no shipped upgrade path diverges from a fresh install in these catalogs either.
Other checks:
compare_to_bash: every bash property covered;harness_selftestPG17: PASSED.🤖 Generated with Claude Code