Skip to content

Instantly share code, notes, and snippets.

@jukkatupamaki
Created July 10, 2020 10:22
Show Gist options
  • Save jukkatupamaki/bbbc6d48dbbab9ff7ffea603930e616f to your computer and use it in GitHub Desktop.
Save jukkatupamaki/bbbc6d48dbbab9ff7ffea603930e616f to your computer and use it in GitHub Desktop.
How to convert a Heroku Postgres dump to plain text

How to convert a Heroku Postgres dump to plain text

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.

  1. Download a backup file and name it e.g. input.dump
  2. Convert input.dump to plain text using pg_restore:
pg_restore --format=c --file=output.sql input.dump
  1. Read contents
cat output.sql | grep 'important api key'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment