How do I convert a binary pgdump (compressed) to a plain SQL file?
pg-dump, pg-restore, postgresql
Solution
`pg_restore`, when run without a database name, outputs a text dump to stdout; you can send that elsewhere with `-f` or with I/O redirection.
pg_restore -f mydatabase.sql mydatabase.dump
Note that you must ensure there's no `PGDATABASE` environment variable set, or it'll try to connect to that database.
Problem
I do want to search for some data inside a database dump but these dumps are using the binary-compressed format (`PGDMP` header). How can I convert these to SQL without restoring them?