I haven't finished reviewing this yet - but there are some things that
need to be fixed.
First, either the creation of the destination directory needs to be
delayed until all the sanity checks have passed and we're sure we're
actually going to write something there, or it needs to be removed if we
error exit before anything gets written there. Example: if there's an
error because I am dumping a 9.1 server and so should have specified
--no-synchronized-snapshots then getting the directory as a by-product
which I need to remove is annoying. Maybe pg_dump -F d should be
prepared to accept an empty directory as well as a non-existent
directory, just as initdb can. Maybe this isn't directly related to this
patch, but I have noticed it more when reviewing this patch.
Second, all the PrintStatus traces are annoying and need to be removed,
or perhaps better only output in debugging mode (using ahlog() instead
of just printf())
cheers
andrew