What this thread does
Do first: inspect a stored backup with pg_restore --list backup.dump, then restore it into a new isolated empty database before treating it as a recovery path.
Short answer
As of November 2026, this procedure targets PostgreSQL 18 client semantics. A logical dump captures a snapshot. Philip Hurst's March 9, 2023 backup overview distinguishes logical dumps from base-backup/WAL recovery.
Choose / don't choose
- Custom/directory archive (respectively
-Fc/-Fd): choose selective or parallel restoration; use archive file formats withpg_restore(pg_dump). - Single transaction: choose an all-or-nothing SQL restore that fits resource limits; don't combine with multiple jobs.
- Parallel restore: choose a measured speed/capacity tradeoff on a fresh target; don't assume a first-error exit removes earlier committed changes (pg_restore).
Not for: backup product selection; see postgres-backups-pg-dump-pgbackrest-barman-or-managed.
Settings that matter
| Setting or flag | Value / default | Applies to | Source |
|---|---|---|---|
| Archive format | custom (-Fc) or directory (-Fd); only directory supports parallel dumping | Archive creation | pg_dump |
--single-transaction | Enable atomic restore; implies --exit-on-error; no multiple jobs | Serial SQL restore | pg_restore |
pg_restore --jobs | Custom/directory archive from a regular file/directory; choose job count from capacity | Parallel restore | pg_restore |
--exit-on-error | Enable first SQL-error exit; default continues/counts errors | Recovery drill | pg_restore |
--use-list | Edited toc.list; selected entries restore in listed order | Selective rehearsal | pg_restore |
Order of operations
1. Record client --version, source/destination majors, extensions, backup object identity/time/size and expected snapshot data. This major's pg_dump reference supports source servers back to 9.2 through its own major, refuses newer source majors, and expects output to load into the newer target major; downgrade loading is not guaranteed. 2. Retrieve the stored backup rather than creating a new local dump. Use a separate instance with required extensions. Restore roles/tablespace prerequisites separately: pg_dump does not dump roles or tablespaces (SQL dump). 3. Save pg_restore -l backup.dump > toc.list. Copy/edit the list for a selective rehearsal; retain dependencies and sensible pre-data/data/post-data ordering. Listing alone is not an integrity or recovery check (pg_restore). 4. For a serial atomic rehearsal, use:
pg_restore --dbname=recovery_drill --exit-on-error --single-transaction backup.dump
For parallel restoration, omit single-transaction and use the chosen jobs count. Treat failure as a failed target and restart from a fresh empty database. 5. Assert expected schema, constraints, indexes, representative records, migration history and application queries as the real application role. Compare against the backup snapshot, not changing live counts. Milan Jovanović's November 4, 2026 drill shows a truncated archive passing listing but failing restore, with a table left behind. 6. Document the failed-deployment procedure: pause writers, select recovery point, provision target, restore prerequisites/archive, run acceptance checks, deploy compatible application version, route traffic, then resume writes. Record owner, elapsed-time budget and how writes newer than the backup are reconciled. Rehearse a failed restore as well as success.
Known failures and fixes
| Error (short quote) | Cause | Fix | Source |
|---|---|---|---|
could not read from input file: end of file | Truncated archive, even when TOC listing succeeds | Reject backup/target; retrieve a complete stored copy and restore into a new empty target | Jovanović drill |
42501 insufficient_privilege | Restore lacks privileges needed for original ownership/grants | Provision correct roles/privileges; only use --no-owner (ownership) / --no-acl (access privileges) for an explicitly limited drill and assess application permissions separately | SQLSTATE, pg_restore |
Missing
- The linked source does not confirm: the illustrative pg_restore --jobs=2 sizing choice.
- RPO/RTO, backup location and post-backup write reconciliation are unspecified; replacing production with an old snapshot can lose valid writes.
- No actual archive or recovery duration is established. Logical restore does not supply continuous point-in-time recovery.
Started from a post by @Milan Jovanović, packaged by the editor. Original post