On Wed, Jul 13, 2016 at 3:06 AM, Jeff Janes <jeff.ja...@gmail.com> wrote:
> On Tue, Jul 12, 2016 at 10:48 AM, Peter Eisentraut
> <peter.eisentr...@2ndquadrant.com> wrote:
>> On 7/12/16 12:53 PM, Jeff Janes wrote:
>>> The --help message for pg_basebackup says:
>>>
>>> -Z, --compress=0-9     compress tar output with given compression level
>>>
>>> But -Z0 is then rejected as 'invalid compression level "0"'.  The real
>>> docs do say 1-9, only the --help message has this bug.  Trivial patch
>>> attached.
>>
>> pg_dump --help and man page say it supports 0..9.  Maybe we should make
>> that more consistent.
>
> pg_dump actually does support -Z0, though.  Well, sort of.  It outputs
> plain text.  Rather than plain text wrapped in some kind of dummy gzip
> header, which is what I had naively expected.
>
> Is that what -Z0 in pg_basebackup should do as well, just output
> uncompressed tar data, and not add the ".gz" to the "base.tar" file
> name?

Yes, I think. What about the attached patch?

Regards,

-- 
Fujii Masao
*** a/doc/src/sgml/ref/pg_basebackup.sgml
--- b/doc/src/sgml/ref/pg_basebackup.sgml
***************
*** 364,370 **** PostgreSQL documentation
        <listitem>
         <para>
          Enables gzip compression of tar file output, and specifies the
!         compression level (1 through 9, 9 being best
          compression). Compression is only available when using the tar
          format.
         </para>
--- 364,370 ----
        <listitem>
         <para>
          Enables gzip compression of tar file output, and specifies the
!         compression level (0 through 9, 0 being no compression and 9 being best
          compression). Compression is only available when using the tar
          format.
         </para>
*** a/src/bin/pg_basebackup/pg_basebackup.c
--- b/src/bin/pg_basebackup/pg_basebackup.c
***************
*** 2073,2079 **** main(int argc, char **argv)
  				break;
  			case 'Z':
  				compresslevel = atoi(optarg);
! 				if (compresslevel <= 0 || compresslevel > 9)
  				{
  					fprintf(stderr, _("%s: invalid compression level \"%s\"\n"),
  							progname, optarg);
--- 2073,2079 ----
  				break;
  			case 'Z':
  				compresslevel = atoi(optarg);
! 				if (compresslevel < 0 || compresslevel > 9)
  				{
  					fprintf(stderr, _("%s: invalid compression level \"%s\"\n"),
  							progname, optarg);
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to