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

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Robert Haas <robertmhaas(at)gmail(dot)com>
Cc: "Daniel Westermann (DWE)" <daniel(dot)westermann(at)dbi-services(dot)com>, "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-10-03 19:32:31
Message-ID: 449352.1727983951@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

Robert Haas <robertmhaas(at)gmail(dot)com> writes:
> On Wed, Oct 2, 2024 at 6:00 AM Daniel Westermann (DWE)
> <daniel(dot)westermann(at)dbi-services(dot)com> wrote:
>> Maybe checking if a valid "-D" or "--pgdata" was given and return a more generic error message would be an option?

> It doesn't really seem reasonable to me to make the tools guess
> whether somebody left out the argument to an option that requires an
> argument. Consider these equivalent cases:
> ...
> I assume there are similar cases that don't involve PostgreSQL at all.

Yeah. This has to be a standard problem for anything that uses getopt
or getopt_long at all. Unless there's a standard approach (which I've
not heard of) to resolving these ambiguities, I'm not sure that we
should try to outsmart everybody else.

In the case of getopt_long there's an additional problem, which is
that that function itself may contain heuristics that rearrange the
argument order based on what looks like a switch or not. It's likely
that anything we did on top of that would behave differently depending
on which version of getopt_long it is.

regards, tom lane

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Andres Freund 2024-10-03 19:40:26 Re: bgwrite process is too lazy
Previous Message Robert Haas 2024-10-03 19:19:45 Re: pg_basebackup and error messages dependent on the order of the arguments