aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/bin/pg_dump/pg_dump.c30
1 files changed, 15 insertions, 15 deletions
diff --git a/src/bin/pg_dump/pg_dump.c b/src/bin/pg_dump/pg_dump.c
index 058244cd171..41a51ec5cd8 100644
--- a/src/bin/pg_dump/pg_dump.c
+++ b/src/bin/pg_dump/pg_dump.c
@@ -722,6 +722,21 @@ main(int argc, char **argv)
plainText = 1;
/*
+ * Custom and directory formats are compressed by default with gzip when
+ * available, not the others. If gzip is not available, no compression is
+ * done by default.
+ */
+ if ((archiveFormat == archCustom || archiveFormat == archDirectory) &&
+ !user_compression_defined)
+ {
+#ifdef HAVE_LIBZ
+ compression_algorithm_str = "gzip";
+#else
+ compression_algorithm_str = "none";
+#endif
+ }
+
+ /*
* Compression options
*/
if (!parse_compress_algorithm(compression_algorithm_str,
@@ -750,21 +765,6 @@ main(int argc, char **argv)
"workers");
/*
- * Custom and directory formats are compressed by default with gzip when
- * available, not the others.
- */
- if ((archiveFormat == archCustom || archiveFormat == archDirectory) &&
- !user_compression_defined)
- {
-#ifdef HAVE_LIBZ
- parse_compress_specification(PG_COMPRESSION_GZIP, NULL,
- &compression_spec);
-#else
- /* Nothing to do in the default case */
-#endif
- }
-
- /*
* If emitting an archive format, we always want to emit a DATABASE item,
* in case --create is specified at pg_restore time.
*/