netbox/docs/administration
Jason Novinger f6c4d69e07 Fixes #23130: Ensure ltree cascade triggers can be restored from a pg_dump
The AFTER triggers which cascade a hierarchical object's path to its
descendants gated themselves on `OLD.path IS DISTINCT FROM NEW.path`.
`IS DISTINCT FROM` is SQL grammar rather than a schema-qualifiable
operator: it expands to the operand type's `=` operator, resolved from
search_path at CREATE TRIGGER time. The ltree extension installs into
`public`, so a CREATE TRIGGER replayed by pg_restore -- which sets
search_path to the empty string and schema-qualifies every name it can --
could not resolve `ltree = ltree` and failed.

Because psql does not stop on error by default, restoring a v4.7.0 dump
reported success while silently omitting all 11 cascade triggers. Renaming
or moving a group object then left its descendants' path and sort_path
stale, with no error surfaced.

Comparing the paths as text resolves `pg_catalog.text =` instead, which is
always available. The comparison is equivalent because ltree's text I/O is
byte-preserving and ltree_eq is a memcmp over the same bytes.

Also reinstalls the triggers on existing databases, which carry either the
old definition (upgraded in place) or no cascade trigger at all (restored
from a dump), and makes InstallLtreeTriggers idempotent so it can be
re-run. Adds -v ON_ERROR_STOP=1 to the documented restore procedure, which
is what allowed the failure to go unnoticed.
2026-09-04 14:11:24 -05:00
..
authentication Merge branch 'main' into feature 2025-09-16 12:00:48 -04:00
error-reporting.md Drop support for deprecated Sentry config parameters (closes #21883) 2026-05-07 08:49:19 -04:00
management-commands.md Misc. cleanup ahead of the v4.7.0 release (#23084) 2026-09-01 08:32:44 -07:00
netbox-shell.md docs(guides): Update Ubuntu reference to 24.04 2026-01-26 15:43:59 -05:00
permissions.md docs(permissions): Add note about JSON escaping in constraint definitions 2026-07-28 09:30:59 -04:00
replicating-netbox.md Fixes #23130: Ensure ltree cascade triggers can be restored from a pg_dump 2026-09-04 14:11:24 -05:00