Skip to main content

Module diff

Module diff 

Source
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::AggregateChange;
pub use change::CastChange;
pub use change::Change;
pub use change::ChangeEntry;
pub use change::CollationChange;
pub use change::EventTriggerChange;
pub use change::ExtensionChange;
pub use change::FunctionChange;
pub use change::GrantDirection;
pub use change::MvChange;
pub use change::ProcedureChange;
pub use change::TableChange;
pub use change::TriggerChange;
pub use change::TsConfigurationChange;
pub use change::TsDictionaryChange;
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::CatalogObjectRef;
pub use owner_op::RoutineSignature;
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§

aggregates
Differ for Catalog::aggregates.
casts
Differ for Catalog::casts.
change
Change — one entry in a ChangeSet.
changeset
ChangeSet — an unordered collection of ChangeEntry values, plus two observation accumulators for downstream lint rules.
cluster
Cluster diffing.
collations
Differ for collations. Per-collation granular diff:
columns
Column-level diffing inside an AlterTable.
constraints
Constraint-level diffing inside an AlterTable.
default_privileges
Diff ALTER DEFAULT PRIVILEGES rules.
destructiveness
Destructiveness — risk classification attached to every diff change.
event_triggers
Differ for Catalog::event_triggers.
extensions
Differ for Catalog::extensions.
grants
Shared grant-list diffing with lenient drift policy.
indexes
Index-level diffing.
owner_grants
The single definition of the per-object owner + grants diff sequence.
owner_op
Catalog-object reference (CatalogObjectRef) and the uniform owner-change op (AlterObjectOwner) shared by the grant and owner diffs.
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 None always means “skip”; catalog values not in source surface as unmanaged-reloption lint, never RESET.
routines
Diff functions and procedures.
schemas
Schema-level diffing.
sequence_op
SequenceOp — per-sequence field updates.
sequences
Sequence-level diffing.
statistics
Differ for statistics. Per-statistic granular diff:
subscriptions
Differ for subscriptions. Pair by name; per-subscription granular diff.
table_op
TableOp — per-table column / constraint operations.
tables
Table-level diffing.
triggers
Differ for Catalog::triggers.
ts_configurations
Differ for Catalog::ts_configurations.
ts_dictionaries
Differ for Catalog::ts_dictionaries.
types
Diff user-defined types (enums, domains, composites).
views
View / MV diff and OR-REPLACE compatibility.

Functions§

diff
Compute the changes needed to converge target toward source.