Postgres Restore Not Restoring Bytea Data This is a very urgent situation.

We have a postgres 9.4 database installed on a CentOs machine.

We are trying to take a backup from a Heroku Postgres database and restore it to the database on CentOs machine.

The commands we are using:
pg_dump -Fc -h ec2-99-99-99-99.compute-1.amazonaws.com -p 5762 -U xyz -d dbname &gt; file.dump

The dump created by pg_dump seems to be missing data from columns that have the type of binary (these columns contain images in binary format).

When we restore this backup to the database on CentOS using following command, all the images from the image i.e. binary type columns are missing:

pg_restore -d onlinedb ~/file.dump

We have to go live in the morning and are completely bummed by this unexpected issue.

Output of \d attachments (attachments is the problem table) command:

             Table "public.attachments"
      Column      |          Type          | Modifiers 
------------------+------------------------+-----------
 id               | integer                | not null
 configuration_id | integer                | 
 style            | character varying(255) | 
 file_contents    | bytea                  | 


More information:
The heroku postgres database from which we are creating backup is PostgreSQL 9.2.6.
The one we are restoring to is PostgreSQL 9.4.
We finally were able to restore the backup. We tried so many things that I am not sure what the fix was, but our conclusion is that the problem was the bytea_output setting in postgresql.conf.
We think Heroku was using value of 'escape' while our database server was using 'hex' and this caused the problem.