Easy way to view postgresql dump files?

I had this same problem and I ended up doing this:

  1. Install Postgresql and PGAdmin3.
  2. Open PGAdmin3 and create a database.
  3. Right click the db and click restore.
  4. Ignore file type.
  5. Select the database dump file from Heroku.
  6. 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