Sometimes you need to search within backups but don't want to restore the dump to a real database.
Backup files produced by Heroku Postgres are compressed. So they need to be converted to plain text.
- Download a backup file and name it e.g.
input.dump
- Convert
input.dump
to plain text usingpg_restore
:
pg_restore --format=c --file=output.sql input.dump
- Read contents
cat output.sql | grep 'important api key'