PostgreSQL – Redirect pg_dump Output to stdout

postgresql

How to redirect pg_dump -Fd output to gzip? It requires that a directory would be specified.

PGPASSWORD=$db_pass pg_dump mydb -U db_user -h localhost --verbose 2>/var/log/postgresql/pgdump.log -Fd | gzip > /mnt/bulk-data/db_backup/mydb_bak.gz

Best Answer

You cannot do that. Use one of the other formats; ideally the custom format, which is automatically compressed.