Pg restore

From PostgreSQL wiki
Jump to navigationJump to search

pg_restore restores a PostgreSQL database from an archive file created by pg_dump. See documentation for details.

Wishlist

This list includes things we might like to be able to do and currently can't. These are unofficial Todo items.

Optimize data load using TRUNCATE before COPY even if we use non-single-transaction and --jobs=1
Somehow we didn't use TRUNCATE-and-COPY optimization in single-threaded restore. Patch submitted here.
Support --single-transaction and --clean to an empty database
Restore fails because --clean generates DROP TABLE. Instead, DROP TABLE IF EXISTS will enable the restore in some cases.
Consistent behavior for --data-only and --clean
We don't add any commands for --clean for data except large objects. TRUNCATE before COPY seems to be a consistent behavior. FYI, we add DROP TABLE before data loading with schema (without --data-only).
Have --compatible-mode to be able to restore other databases
"pg_dump --column-inserts" generates a bit more portable dump, but there are still issues, like BOOLEAN vs BIT.