Skip to content

Commit 928e92f

Browse files
committed
Fix pg_basebackup so that it accepts 0 as a valid compression level.
The help message for pg_basebackup specifies that the numbers 0 through 9 are accepted as valid values of -Z option. But, previously -Z 0 was rejected as an invalid compression level. Per discussion, it's better to make pg_basebackup treat 0 as valid compression level meaning no compression, like pg_dump. Back-patch to all supported versions. Reported-By: Jeff Janes Reviewed-By: Amit Kapila Discussion: CAMkU=1x+GwjSayc57v6w87ij6iRGFWt=hVfM0B64b1_bPVKRqg@mail.gmail.com
1 parent c0782a1 commit 928e92f

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

doc/src/sgml/ref/pg_basebackup.sgml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -343,7 +343,7 @@ PostgreSQL documentation
343343
<listitem>
344344
<para>
345345
Enables gzip compression of tar file output, and specifies the
346-
compression level (1 through 9, 9 being best
346+
compression level (0 through 9, 0 being no compression and 9 being best
347347
compression). Compression is only available when using the tar
348348
format.
349349
</para>

src/bin/pg_basebackup/pg_basebackup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2050,7 +2050,7 @@ main(int argc, char **argv)
20502050
break;
20512051
case 'Z':
20522052
compresslevel = atoi(optarg);
2053-
if (compresslevel <= 0 || compresslevel > 9)
2053+
if (compresslevel < 0 || compresslevel > 9)
20542054
{
20552055
fprintf(stderr, _("%s: invalid compression level \"%s\"\n"),
20562056
progname, optarg);

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy