Easy way to view postgresql dump files?
I had this same problem and I ended up doing this:
- Install Postgresql and PGAdmin3.
- Open PGAdmin3 and create a database.
- Right click the db and click restore.
- Ignore file type.
- Select the database dump file from Heroku.
- Click Restore.
Try opening the files with text editor - the default dump format is plain text.
If the dump is not plain text - try using pg_restore -l your_db_dump.file
command. It will list all objects in the database dump (like tables, indexes ...).
Another possible way (may not work, haven't tried it) is to grep
through the output of pg_restore your_db_dump.file
command. If I understood correctly the manual - the output of pg_restore
is just a sequence of SQL queries, that will rebuild the db.
This was what I was looking for:
pg_restore db.bin > db.sql
Thanks @andrewtweber
In newer versions you need to specify the -f
flag with a filename or '-' for stdout
pg_restore -f - dump_file.bin