Skip to main content

Module casts

Module casts 

Source
Expand description

Differ for Catalog::casts.

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

Identity is (source, target). Because QualifiedName does not implement Ord, the BTreeMap key is (String, String) where each String is QualifiedName::render_sql() — a stable, canonical representation.

Logic summary:

  • source-only → Create (Safe).
  • target-only → Drop (Safe — casts carry no data).
  • both present, method or context differ → Replace (Safe — Postgres has no ALTER CAST; subsumes comment).
  • else: comment differs → CommentOn (Safe).

Functions§

diff_casts
Compute cast changes needed to converge target (live) toward source.