Error loading example PostgreSQL database: "Could not find header for file ..." I am learning o use PostgreSQL so I am trying to insert a whole practice database "dvdrental", which I downloaded from PostgreSQL learning blog. I am on a Mac OSX and I am using PostgreSQL through my terminal (and ZSH).

These are the steps I took:


download dvdrental.zip file
create dvdrental database under the right user, with the right permissions
unzipped dvdrental.zip
tar-ed the folder that I extracted from .zip file


Here is an ls -l output of that is inside the extracted directory:

2163.dat
2165.dat
2167.dat
2168.dat
2169.dat
2171.dat
2173.dat
2175.dat
2177.dat
2179.dat
2181.dat
2183.dat
2185.dat
2187.dat
2189.dat
restore.sql
toc.dat


Here is the command that I am using to get the sample db dump into my newly created db:

~&gt;pg_restore -U postgres -d weather /users/edchigliak/downloads/dvdrental.tar


The error I receive:

~&gt;pg_restore: [tar archiver] could not find header for file "toc.dat" in tar archive
restore.sql is a plain SQL statement file in your "dvdrental.tar" file. First create your db with the statement below;

CREATE DATABASE db_name ENCODING = 'UTF8';


After that, instead of using pg_restore you can use psql.

psql --echo-all --file=restore.sql db_name