Skip to content

Commit cae2bb1

Browse files
committed
Make pg_dump behave more sanely when built without HAVE_LIBZ.
For some reason the code to emit a warning and switch to uncompressed output was placed down in the guts of pg_backup_archiver.c. This is definitely too late in the case of parallel operation (and I rather wonder if it wasn't too late for other purposes as well). Put it in pg_dump.c's option-processing logic, which seems a much saner place. Also, the default behavior with custom or directory output format was to emit the warning telling you the output would be uncompressed. This seems unhelpful, so silence that case. Back-patch to 9.3 where parallel dump was introduced. Kyotaro Horiguchi, adjusted a bit by me Report: <20160526.185551.242041780.horiguchi.kyotaro@lab.ntt.co.jp>
1 parent df8d2d8 commit cae2bb1

File tree

2 files changed

+9
-10
lines changed

2 files changed

+9
-10
lines changed

src/bin/pg_dump/pg_backup_archiver.c

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3475,17 +3475,7 @@ WriteHead(ArchiveHandle *AH)
34753475
(*AH->WriteBytePtr) (AH, AH->intSize);
34763476
(*AH->WriteBytePtr) (AH, AH->offSize);
34773477
(*AH->WriteBytePtr) (AH, AH->format);
3478-
3479-
#ifndef HAVE_LIBZ
3480-
if (AH->compression != 0)
3481-
write_msg(modulename, "WARNING: requested compression not available in this "
3482-
"installation -- archive will be uncompressed\n");
3483-
3484-
AH->compression = 0;
3485-
#endif
3486-
34873478
WriteInt(AH, AH->compression);
3488-
34893479
crtm = *localtime(&AH->createDate);
34903480
WriteInt(AH, crtm.tm_sec);
34913481
WriteInt(AH, crtm.tm_min);

src/bin/pg_dump/pg_dump.c

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -589,12 +589,21 @@ main(int argc, char **argv)
589589
/* Custom and directory formats are compressed by default, others not */
590590
if (compressLevel == -1)
591591
{
592+
#ifdef HAVE_LIBZ
592593
if (archiveFormat == archCustom || archiveFormat == archDirectory)
593594
compressLevel = Z_DEFAULT_COMPRESSION;
594595
else
596+
#endif
595597
compressLevel = 0;
596598
}
597599

600+
#ifndef HAVE_LIBZ
601+
if (compressLevel != 0)
602+
write_msg(NULL, "WARNING: requested compression not available in this "
603+
"installation -- archive will be uncompressed\n");
604+
compressLevel = 0;
605+
#endif
606+
598607
/*
599608
* On Windows we can only have at most MAXIMUM_WAIT_OBJECTS (= 64 usually)
600609
* parallel jobs because that's the maximum limit for the

0 commit comments

Comments
 (0)