We create a "custom" format (-Fc) dump file of our production DB each night. One of the things this is used for is restoring into a test DB. We then run a number of update queries to anonymise the data, but because there are millions of rows this is rather a time-consuming task.
I had the idea that if we used the "directory" format (-Fd) dump then I could run some scripts to directly modify the data in that dump. Then instead of the two step (pg_restore+updates) we'd simply be restoring anonymised data in a single step.
However I still need the custom dump file for feeding into other processes, and I'd prefer to avoid dumping twice if possible. So I was wondering if it's possible to take a custom format dump file and convert it into a directory format dump.