Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 74d8c95

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 11653cd commit 74d8c95

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

doc/src/sgml/ref/pg_basebackup.sgml

+1-1
Original file line numberDiff line numberDiff line change
@@ -364,7 +364,7 @@ PostgreSQL documentation
364364
<listitem>
365365
<para>
366366
Enables gzip compression of tar file output, and specifies the
367-
compression level (1 through 9, 9 being best
367+
compression level (0 through 9, 0 being no compression and 9 being best
368368
compression). Compression is only available when using the tar
369369
format.
370370
</para>

src/bin/pg_basebackup/pg_basebackup.c

+1-1
Original file line numberDiff line numberDiff line change
@@ -2073,7 +2073,7 @@ main(int argc, char **argv)
20732073
break;
20742074
case 'Z':
20752075
compresslevel = atoi(optarg);
2076-
if (compresslevel <= 0 || compresslevel > 9)
2076+
if (compresslevel < 0 || compresslevel > 9)
20772077
{
20782078
fprintf(stderr, _("%s: invalid compression level \"%s\"\n"),
20792079
progname, optarg);

0 commit comments

Comments
 (0)