2

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 > 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.

1

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.