Re: pg_basebackup and error messages dependent on the order of the arguments

From: "Daniel Westermann (DWE)" <daniel(dot)westermann(at)dbi-services(dot)com>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: "pgsql-hackers(at)postgresql(dot)org" <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: pg_basebackup and error messages dependent on the order of the arguments
Date: 2024-09-30 17:56:51
Message-ID: GV0P278MB0419BDE2D5D3E2C5C19EF411D2762@GV0P278MB0419.CHEP278.PROD.OUTLOOK.COM
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

>I wrote:
>> As this example shows, we really ought to validate the compression
>> argument on sight in order to get sensible error messages. The
>> trouble is that for server-side compression the code wants to just
>> pass the string through to the server and not form its own opinion
>> as to whether it's a known algorithm.

>> Perhaps it would help if we simply rejected strings beginning
>> with a dash? I haven't tested, but roughly along the lines of

>Taking a closer look, many of the other switches-requiring-an-argument
>also just absorb "optarg" without checking its value till much later,
>so I'm not sure how far we could move the needle by special-casing
>--compress.

My point was not so much about --compress but rather giving a good error message.

Looking at this:
$ pg_basebackup --checkpoint=fast --format=t --compress --pgdata=/var/tmp/dummy
pg_basebackup: error: must specify output directory or backup target

... the error message is misleading and will confuse users more than it helps.

Regards
Daniel

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Jim Jones 2024-09-30 18:16:09 Re: Psql meta-command conninfo+
Previous Message Laurenz Albe 2024-09-30 17:17:38 Re: On disable_cost