8000 Fix pg_basebackup so that it accepts 0 as a valid compression level. · linearregression/postgres@366f4a9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 366f4a9

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 reje 10000 cted 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 7004e1c commit 366f4a9

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
@@ -185,7 +185,7 @@ PostgreSQL documentation
185185
<listitem>
186186
<para>
187187
Enables gzip compression of tar file output, and specifies the
188-
compression level (1 through 9, 9 being best
188+
compression level (0 through 9, 0 being no compression and 9 being best
189189
compression). Compression is only available when using the tar
190190
format.
191191
</para>

src/bin/pg_basebackup/pg_basebackup.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1059,7 +1059,7 @@ main(int argc, char **argv)
10591059
break;
10601060
case 'Z':
10611061
compresslevel = atoi(optarg);
1062-
if (compresslevel <= 0 || compresslevel > 9)
1062+
if (compresslevel < 0 || compresslevel > 9)
10631063
{
10641064
fprintf(stderr, _("%s: invalid compression level \"%s\"\n"),
10651065
progname, optarg);

0 commit comments

Comments
 (0)
0