Question

I am trying to use a pg_dump from heroku in my dev environment.

Seems like I can use pg_restore to do it once I have downloaded the dump: http://www.postgresql.org/docs/current/static/app-pgrestore.html

I am unable to use the utility correctly and may be someone can help me here

This is the command I am using:

➜  myapp git:(master) ✗ pg_restore --dbname=myapp_development ~/Downloads/2013-12-27-06-04-23.dump

I get bunch of schema already exists , role does not exist errors.

pg_restore: [archiver (db)] Error while PROCESSING TOC:
pg_restore: [archiver (db)] Error from TOC entry 181; 1259 4558648 TABLE authentications hsddtzyenpyiuasdu
pg_restore: [archiver (db)] could not execute query: ERROR:  relation "authentications" already exists


ERROR:  relation "authentications_id_seq" already exists

pg_restore: [archiver (db)] could not execute query: ERROR:  role "hsddtzyenpyiuasdu" does not exist

I bet there is a simpler and cleaner way to do this. Would appreciate if someone gives the steps and list of commands to be able to use prod heroku pg db in development.

Thanks PS: The amount of data and schema is extremely small (dump: 6MB)

Was it helpful?

Solution

Use --data-only modifier:

-a --data-only Restore only the data, not the schema (data definitions). Table data, large objects, and sequence values are restored, if present in the archive.

This option is similar to, but for historical reasons not identical to, specifying --section=data.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top