Skip to content

Leave linked sequence owners to their table; pull and diff NOT VALID domain checks, large object default privileges and materialized view column settings; report user mappings - #365

Merged
archlemon merged 3 commits into
mainfrom
pull-fidelity-misc
Nov 21, 2026

Conversation

@archlemon

Copy link
Copy Markdown
Member

Fixes #340
Fixes #341
Fixes #346
Fixes #349
Fixes #352

Five pull/rebuild gaps found by the PostgreSQL 19 probe. Each probe fixture now pulls, rebuilds, self-diffs clean and gives the same pg_dump on 15, 18 and 19 (f25_dp on 18 and 19 only, since it needs PostgreSQL 18).

  • Sequence owner fails when the sequence is OWNED BY a column #340 Sequence owned by a column. A sequence linked with OWNED BY always has its table's owner, and PostgreSQL rejects ALTER SEQUENCE ... OWNER TO on it. pgy pull --owners no longer writes owner for such a sequence. planOwners skips the owner of a sequence that ends up linked: one whose ownedBy names a column, or one that leaves ownedBy unmanaged and is linked in the database. ownedBy: none still applies the owner, after the OWNED BY NONE. pgy validate warns about an owner next to an ownedBy column. Identity and serial sequences were already handled: pull writes no owner for them and validate rejects one.
  • NOT VALID domain check is pulled with NOT VALID inside the expression #341 NOT VALID domain checks. Domain checks in the checks map form now accept notValid: true, which adds the check with ALTER DOMAIN ... ADD CONSTRAINT ... NOT VALID. A domain created by the plan gets its NOT VALID checks right after CREATE DOMAIN. Removing notValid emits ALTER DOMAIN ... VALIDATE CONSTRAINT, and so does a NOT VALID check the YAML doesn't mark. A check validated outside pgy while the YAML still says notValid is not treated as a change. Pull strips NOT VALID from the expression and writes {check, notValid: true}. (Domain NOT NULL NOT VALID is left out: PostgreSQL 19.0 has no syntax for it.)
  • Default privileges on large objects are pulled as key L #346 Default privileges on large objects. defaultPrivileges entries gain a largeObjects kind (select, update; all expands to both). It emits ALTER DEFAULT PRIVILEGES ... ON LARGE OBJECTS, is introspected from defaclobjtype 'L' and pulled under that key. pgy diff gives a version warning on servers older than 18, and pgy validate rejects it together with in: (PostgreSQL doesn't allow IN SCHEMA there).
  • Materialized view column compression is lost #349 Materialized view column settings. Materialized views gain a columns: map with compression, storage, statisticsTarget and nDistinct per column. Before this, all four were lost, not only compression. They are introspected in a new query in the existing batch, diffed with ALTER MATERIALIZED VIEW ... ALTER COLUMN, pulled when they differ from what CREATE MATERIALIZED VIEW gives, and restored from live when the view is recreated and the YAML leaves them unmanaged. pgy validate rejects columns on a plain view.
  • pull drops user mappings without saying so #352 User mappings. Pull now lists user mappings (read from pg_user_mappings, without their options) as objects it leaves out. It warns on stderr and in the --json warnings, for example: user mapping for pgy server p19_loop was left out: pgy doesn't manage user mappings, whose options hold credentials; create it by hand on the database you rebuild. Mappings on a server an external role owns are not reported.

JSON Schema, docs/schema.md and docs/feature_support.md are updated.

Tests: unit tests in internal/schema, internal/diff, internal/pull and internal/validate. Integration tests cover the user mapping warning, the NOT VALID domain check lifecycle and the large object defaults (the version warning before 18). The new pull fixture linked_sequences_and_not_valid.sql covers the linked sequence with owners, the NOT VALID domain checks, the matview column settings and, on 18+, the large object defaults. make test, go vet ./... and the integration suite pass on PostgreSQL 15, 18 and 19.

…d diff NOT VALID domain checks, default privileges on large objects and materialized view column settings, report user mappings that pull leaves out.
# Conflicts:
#	docs/feature_support.md
#	internal/diff/details.go
#	internal/diff/diff.go
@archlemon
archlemon merged commit e2ec84e into main Nov 21, 2026
8 checks passed
@archlemon
archlemon deleted the pull-fidelity-misc branch November 21, 2026 02:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant