Re: PG 14 pg_basebackup accepts --compress=server-zst option

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Ron Johnson <ronljohnsonjr(at)gmail(dot)com>
Cc: pgsql-general <pgsql-general(at)postgresql(dot)org>
Subject: Re: PG 14 pg_basebackup accepts --compress=server-zst option
Date: 2024-06-07 15:33:08
Message-ID: 1251342.1717774388@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Ron Johnson <ronljohnsonjr(at)gmail(dot)com> writes:
> On Fri, Jun 7, 2024 at 12:32 AM David G. Johnston <
> david(dot)g(dot)johnston(at)gmail(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Lok P 2024-06-08 07:23:03 Creating big indexes
Previous Message Adrian Klaver 2024-06-07 15:15:56 Re: Questions on logical replication