Troubleshooting·PostgreSQL
PostgreSQL Custom Format Dumps and Selective Restore
A custom-format dump carries a table of contents, so you can restore one table out of it. Doing that here fails - because filtering to a table does not bring its schema along, and pg_restore will not create what you filtered out.
Backup and Restore Guide 23 of 47 Intermediate
- OSUbuntu 26.04 LTS
- PostgreSQL18.6-0ubuntu0.26.04.1
- wal_levelreplica
- TimeAbout 15 min
Custom format is compressed and indexable. It is the format to use for anything you might restore selectively, which is most things.
| Server Name | IP Address | OS | Roles | CPU | RAM | HDD |
|---|---|---|---|---|---|---|
| db-a01 | 192.168.0.81 | Ubuntu 26.04 LTS | Primary / Source / Replica Set Member 1 | 2 Core | 4 GB | 50 GB |
This guide includes
Use this when only one table has to come back. This matters because a custom-format dump carries a table of contents - so pg_restore can take a single object, provided whatever it depends on already exists.
- dumping in custom format, and reading its table of contents
- restoring one table into an empty database, and watching it fail
- creating the dependency by hand, then running the identical command successfully
Before you start
- The
appdbdatabase.
-
Dump in custom format and read its table of contents
-
Restore one table, and watch it fail
-
Create the dependency, then restore