Postgres tutorial: pg_restore: input file [archiver] is not a valid archive

I work through a Postgres DVD tutorial and run issues importing their sample database.

Running pg_restore -U postgres -d dvdrental ~[filepath]/dvd-database.tar.gz gives me pg_restore: [archiver] input file does not appear to be a valid archive .

My process so far has been as follows:

  • Download the dvdrental.zip file
  • Extract it to .tar using tar czf dvd-database.tar.gz dvdrental.zip (I also tried to extract the zip to the folder first with the same result and also delete .gz)
  • Running pg_restore -U postgres -d dvdrental ~[filepath]/dvd-database.tar as above.

I am currently using Postgres 9.5, which may cause a problem. Looking for an answer that indicates where I am making a mistake in this process, or how to update the archive of a Postgres database to 9.5.

+5
source share
1 answer

In the comments above, the solution was simple.

Extracting the dvdrental.zip file into an uncompressed .tar file is not required, as indicated in the tutorial instructions. pg_restore will work if it pg_restore to the directory in which the database dump was deleted.

+4
source

Source: https://habr.com/ru/post/1242455/


All Articles