Question

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.

Was it helpful?

Solution

No, that is not possible. But there is no advantage in a custom format dump over a directory format dump (except that the latter is not a single file), so you might just use the directory format dump. You'd gain parallel pg_dump in the bargain.

Licensed under: CC-BY-SA with attribution
Not affiliated with dba.stackexchange
scroll top