What is the key to pg_restore?
In cases like this and the size of the DB (>17 Gb) I suggest based on the official documentation for version 9.2 the following:


do a pgdump_all


pg_dumpall [connection-option...] [option...]

pg_dumpall &gt; databackup.out


Restore with psql. I have found out a better execution and stability


psql -f databackup.out postgres


Take extreme precaution with the file encoding. Specially if you are doing migrations among different OS and specially if you are uploading to a cloud RDBMS provider.