Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

pg_restore: [archiver] input file is too short error in postgres

I am trying to dump the database in my local system by using the command :

pg_restore --host=localhost --port=5432 --dbname=dev_db --no-owner --no-privileges db_dump_new.backup

but I am getting the error :

pg_restore: [archiver] input file is too short (read 0, expected 5)

What am I doing wrong?

like image 714
the_unknown_spirit Avatar asked Apr 07 '16 07:04

the_unknown_spirit


People also ask

What is Pg_restore in Postgres?

Description. pg_restore is a utility for restoring a PostgreSQL database from an archive created by pg_dump in one of the non-plain-text formats. It will issue the commands necessary to reconstruct the database to the state it was in at the time it was saved.


Video Answer


1 Answers

If you're using docker and redirecting the dump file from your local machine, don't forget -i. This won't work:

docker exec <container> pg_restore -U "$USER" < ./localfile.dump;

Be sure that the docker container can see standard in with the -i option! This should work:

docker exec -i <container> pg_restore -U "$USER" < ./localfile.dump;
like image 143
lmat - Reinstate Monica Avatar answered Sep 28 '22 16:09

lmat - Reinstate Monica