Re: PG 14 pg_basebackup accepts --compress=server-zst option - Mailing list pgsql-general

From Tom Lane
Subject Re: PG 14 pg_basebackup accepts --compress=server-zst option
Date
Msg-id 1251342.1717774388@sss.pgh.pa.us
Whole thread Raw
In response to Re: PG 14 pg_basebackup accepts --compress=server-zst option  (Ron Johnson <ronljohnsonjr@gmail.com>)
List pgsql-general
Ron Johnson <ronljohnsonjr@gmail.com> writes:
> On Fri, Jun 7, 2024 at 12:32 AM David G. Johnston <
> david.g.johnston@gmail.com> wrote:
>> I don’t see us adding an error message at this point.

> Me neither.  It just seemed odd.

v14 thinks the argument of --compress must be an integer, and doesn't
really bother with any syntax error checks:

            case 'Z':
                compresslevel = atoi(optarg);
                if (compresslevel < 0 || compresslevel > 9)
                {
                    pg_log_error("invalid compression level \"%s\"", optarg);
                    exit(1);
                }
                break;

In your example, atoi() will return zero and it will sail along with
no compression.  Releases 15 and up have more complex ideas of what
--compress can specify, and seem to syntax-check it much more
thoroughly.

This is a pretty common coding pattern, so I can't get excited
about changing it, especially not in long-stable branches.

            regards, tom lane



pgsql-general by date:

Previous
From: Adrian Klaver
Date:
Subject: Re: Questions on logical replication
Next
From: Lok P
Date:
Subject: Creating big indexes