Expand description
Pure-function diff over the IR.
diff(target, source) returns a ChangeSet describing every structural
difference between two Catalog snapshots.
No SQL is generated here — that is the job of phases 5+ (planner, rewrites).
§Direction
diff(target, source) describes the changes needed to take the target
catalog and turn it into the source catalog. In pgevolve terminology, the
“target” is the live database and the “source” is the desired state declared
in *.sql files; running the resulting plan converges target to source.
Re-exports§
pub use change::Change;pub use change::ChangeEntry;pub use change::ExtensionChange;pub use change::FunctionChange;pub use change::MvChange;pub use change::ProcedureChange;pub use change::TableChange;pub use change::TriggerChange;pub use change::UserTypeChange;pub use change::ViewChange;pub use changeset::ChangeSet;pub use changeset::RevokeWithOwnerObservation;pub use changeset::UnmanagedGrantObservation;pub use cluster::ClusterChange;pub use cluster::ClusterChangeEntry;pub use cluster::ClusterChangeSet;pub use cluster::diff_cluster;pub use destructiveness::Destructiveness;pub use owner_op::AlterObjectOwner;pub use owner_op::OwnerObjectKind;pub use routines::diff_functions;pub use routines::diff_procedures;pub use sequence_op::SequenceOp;pub use sequence_op::SequenceOpEntry;pub use table_op::TableOp;pub use table_op::TableOpEntry;
Modules§
- change
Change— one entry in aChangeSet.- changeset
ChangeSet— an unordered collection ofChangeEntryvalues, plus two observation accumulators for downstream lint rules.- cluster
- Cluster diffing.
- columns
- Column-level diffing inside an
AlterTable. - constraints
- Constraint-level diffing inside an
AlterTable. - default_
privileges - Diff
ALTER DEFAULT PRIVILEGESrules. - destructiveness
Destructiveness— risk classification attached to every diff change.- extensions
- Differ for
Catalog::extensions. - grants
- Shared grant-list diffing with lenient drift policy.
- indexes
- Index-level diffing.
- owner_
op AlterObjectOwner— uniform owner-change op across grantable families.- policies
- Per-table policy diffing + RLS toggles.
- publications
- Differ for publications. Pair by name; per-publication granular diff.
- reloptions
- Sparse-delta diffing for storage reloptions. Lenient policy:
source
Nonealways means “skip”; catalog values not in source surface asunmanaged-reloptionlint, never RESET. - routines
- Diff functions and procedures.
- schemas
- Schema-level diffing.
- sequence_
op SequenceOp— per-sequence field updates.- sequences
- Sequence-level diffing.
- table_
op TableOp— per-table column / constraint operations.- tables
- Table-level diffing.
- triggers
- Differ for
Catalog::triggers. - types
- Diff user-defined types (enums, domains, composites).
- views
- View / MV diff and OR-REPLACE compatibility.
Functions§
- diff
- Compute the changes needed to converge
targettowardsource.