From 2c2db63ede38c2e61fb655ab38303f4160ec3f6c Mon Sep 17 00:00:00 2001 From: Georgios Kokolatos Date: Thu, 26 Jan 2023 09:58:10 +0000 Subject: [PATCH v26 1/4] Address regression in pg_dump's ReadHead Commit 5e73a6048 upgraded the check for supported compression while parsing an archive's header, from warning to fatal. Prior to this commit, it was possible to restore a compressed archive's schema even when the compression was not supported by the binary. Before the abovementioned commit, a warning message would be emmited: pg_log_warning("archive is compressed, but this installation does not support compression -- no data will be available"); This message is slightly miss-leading, as it can be interpreted that the binary will actively switch into schema only mode, which is not the case. Instead a new fatal message will appear informing that the compression is not available. This commit chooses to remove the check in ReadHead altogether in favour of a more comprehensive error message when checking the archive for data. Regression spotted by: Justin Pryzby --- src/bin/pg_dump/pg_backup_archiver.c | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/bin/pg_dump/pg_backup_archiver.c b/src/bin/pg_dump/pg_backup_archiver.c index ba5e6acbbb..25b1ea0026 100644 --- a/src/bin/pg_dump/pg_backup_archiver.c +++ b/src/bin/pg_dump/pg_backup_archiver.c @@ -398,7 +398,7 @@ RestoreArchive(Archive *AHX) for (te = AH->toc->next; te != AH->toc; te = te->next) { if (te->hadDumper && (te->reqs & REQ_DATA) != 0) - pg_fatal("cannot restore from compressed archive (compression not supported in this installation)"); + pg_fatal("cannot restore data from compressed archive (compression not supported in this installation)"); } } #endif @@ -3782,11 +3782,6 @@ ReadHead(ArchiveHandle *AH) else AH->compression_spec.algorithm = PG_COMPRESSION_GZIP; -#ifndef HAVE_LIBZ - if (AH->compression_spec.algorithm == PG_COMPRESSION_GZIP) - pg_fatal("archive is compressed, but this installation does not support compression"); -#endif - if (AH->version >= K_VERS_1_4) { struct tm crtm; -- 2.34.1