Restore reports failure on partitioned tables: pg_restore --clean cannot drop inherited partition PKs #288
Labels
No Label
area:auth
area:docs
area:export
area:ops
area:storage
area:supply-chain
auth
backend
blocked
collab
deployment
docs
effort:L
effort:M
effort:S
frontend
plugins
qa
vs-nfd
vs-nfd:blocker
No Milestone
No project
No Assignees
1 Participants
Notifications
Due Date
No due date set.
Dependencies
No dependencies set.
Reference: stwaidele/dorfteich#288
Loading…
Reference in New Issue
Block a user
No description provided.
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Found during the isolated deployment run (#220).
Symptom:
node dist/restore.js <set>(and therefore the in-app restore orchestrator, which sharesperformRestore) reports FAILED although the database content is restored correctly:Cause: since #224
read_eventsis a partitioned table. The dump contains the per-partition primary keys as separateALTER TABLE ONLY ... ADD CONSTRAINTentries, sopg_restore --clean --if-existsemits matchingDROP CONSTRAINTstatements against the live database — where those constraints are inherited from the parent's primary key and cannot be dropped individually.pg_restoreexits non-zero,runPgToolthrows, the restore is reported as failed even though the subsequent drop/recreate of the tables succeeded.Fix: reset the schema before running
pg_restore:DROP SCHEMA IF EXISTS public CASCADE; CREATE SCHEMA public;(the database uses no extensions outsidepg_catalog). All--cleandrops then become no-ops, and the restore also becomes faithful — objects created after the backup no longer survive a restore. Keep--clean --if-existsas belt and braces.Verification: re-run the restore in the isolated environment of #220 against set
20260731-132200— must exit 0 and leave exactly the pre-backup content.Fixed by PR #289 (merged, CI run 618 green, CD 622 deployed Test+Int, readyz fully green on both).
Verified in the isolated environment of #220: restore of set
20260731-132200now exits 0, a deliberately created post-backup table is gone (the schema reset makes the restore faithful), page content and allread_eventspartitions intact,/readyzfully green after api restart. Evidence:docs/vs-nfd/97-isolationslauf-protokoll.md§Abweichungen.