Restoring a postgres database hangs – with no error

It’s waiting for input on stdin.

-f specifies an output file, not an input file. With no input it’s waiting for input on stdin. If you type ctrl-d to end input it will say something like pg_restore: error: input file is too short (read 0, expected 5).

The proper invocation is…

pg_restore --dbname=DatabaseName -Upostgres --format=tar example.tar

--dbname is the name of the database to restore to. If it does not exist, add --create to tell pg_restore to create it.

The --format=tar is not strictly necessary, pg_restore can guess the file type, but why risk it?

See the pg_restore docs.

CLICK HERE to find out more related problems solutions.

Leave a Comment

Your email address will not be published.

Scroll to Top