Repository navigation
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
Conversation
…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
# Conflicts: # docs/feature_support.md # internal/diff/details.go # internal/diff/diff.go
This was referenced Nov 21, 2026
Closed
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.
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_dumpon 15, 18 and 19 (f25_dpon 18 and 19 only, since it needs PostgreSQL 18).OWNED BYalways has its table's owner, and PostgreSQL rejectsALTER SEQUENCE ... OWNER TOon it.pgy pull --ownersno longer writesownerfor such a sequence.planOwnersskips the owner of a sequence that ends up linked: one whoseownedBynames a column, or one that leavesownedByunmanaged and is linked in the database.ownedBy: nonestill applies the owner, after theOWNED BY NONE.pgy validatewarns about anownernext to anownedBycolumn. Identity and serial sequences were already handled: pull writes no owner for them and validate rejects one.checksmap form now acceptnotValid: true, which adds the check withALTER DOMAIN ... ADD CONSTRAINT ... NOT VALID. A domain created by the plan gets its NOT VALID checks right afterCREATE DOMAIN. RemovingnotValidemitsALTER DOMAIN ... VALIDATE CONSTRAINT, and so does a NOT VALID check the YAML doesn't mark. A check validated outside pgy while the YAML still saysnotValidis not treated as a change. Pull stripsNOT VALIDfrom the expression and writes{check, notValid: true}. (DomainNOT NULL NOT VALIDis left out: PostgreSQL 19.0 has no syntax for it.)defaultPrivilegesentries gain alargeObjectskind (select,update;allexpands to both). It emitsALTER DEFAULT PRIVILEGES ... ON LARGE OBJECTS, is introspected fromdefaclobjtype 'L'and pulled under that key.pgy diffgives a version warning on servers older than 18, andpgy validaterejects it together within:(PostgreSQL doesn't allowIN SCHEMAthere).columns:map withcompression,storage,statisticsTargetandnDistinctper column. Before this, all four were lost, not only compression. They are introspected in a new query in the existing batch, diffed withALTER MATERIALIZED VIEW ... ALTER COLUMN, pulled when they differ from whatCREATE MATERIALIZED VIEWgives, and restored from live when the view is recreated and the YAML leaves them unmanaged.pgy validaterejectscolumnson a plain view.pg_user_mappings, without their options) as objects it leaves out. It warns on stderr and in the--jsonwarnings, 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.mdanddocs/feature_support.mdare updated.Tests: unit tests in
internal/schema,internal/diff,internal/pullandinternal/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 fixturelinked_sequences_and_not_valid.sqlcovers 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.