1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-09 06:21:09 +03:00

Fix thinko coming from 000f3adf

pg_basebackup.c relies on the compression level to not be 0 to decide if
compression should be used, but 000f3adf missed the fact that the
default compression (Z_DEFAULT_COMPRESSION) is -1, which would be used
if specifying --gzip without --compress.

While on it, add some coverage for --gzip, as this is rather easy to
miss.

Reported-by: Christoph Berg
Discussion: https://postgr.es/m/YdhRDMLjabtXOnhY@msg.df7cb.de
This commit is contained in:
Michael Paquier
2022-01-08 09:12:21 +09:00
parent 27b77ecf9f
commit d0d62262d3
2 changed files with 18 additions and 5 deletions

View File

@@ -524,7 +524,7 @@ LogStreamerMain(logstreamer_param *param)
stream.do_sync);
else
stream.walmethod = CreateWalTarMethod(param->xlog,
(compresslevel > 0) ?
(compresslevel != 0) ?
COMPRESSION_GZIP : COMPRESSION_NONE,
compresslevel,
stream.do_sync);