Expand description
View / MV diff and OR-REPLACE compatibility.
§Body change detection
Two view bodies are considered identical when their canonical_hash bytes
are equal. This avoids fragile text comparison and is already the canonical
form produced by T4’s AST canonicalization pass and by the catalog reader.
§OR-REPLACE compatibility
Per Postgres’s CREATE OR REPLACE VIEW rules the new definition must:
- Have at least as many columns as the existing view.
- Keep the same column names at the same positions.
- Keep the same types at the same positions.
New columns may only be appended at the end.
or_replace_compatible encodes exactly these rules.
Functions§
- diff_
materialized_ views - Diff
target.materialized_views(live DB) againstsource.materialized_views(desired). - diff_
views - Diff
target.views(live DB) againstsource.views(desired).