Skip to main content

Module aggregates

Module aggregates 

Source
Expand description

Differ for Catalog::aggregates.

Aggregates are managed (schema-scoped): a live aggregate that is absent from source IS auto-dropped — unlike lenient objects such as event triggers or statistics.

Identity is (qname, arg_types). Because ColumnType does not implement Ord, the BTreeMap key is (QualifiedName, Vec<String>) where each String is ColumnType::render_sql() — a stable, canonical representation.

Logic summary:

  • source-only → Create (Safe).
  • target-only → Drop (Safe — aggregates carry no data).
  • both present, structural diff (state_type / sfunc / finalfunc / initcond) → Replace (Safe, subsumes owner/comment).
  • else: owner lenient (only when source declares one) → AlterOwner (Safe).
  • comment differs → CommentOn (Safe).

Functions§

diff_aggregates
Compute aggregate changes needed to converge target (live) toward source.