From: | Michael Paquier <michael(at)paquier(dot)xyz> |
---|---|
To: | Bharath Rupireddy <bharath(dot)rupireddyforpostgres(at)gmail(dot)com> |
Cc: | Dilip Kumar <dilipbalaut(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org> |
Subject: | Re: pg_dump, pg_basebackup don't error out with wrong option for "--format" |
Date: | 2021-11-26 06:55:11 |
Message-ID: | YaCEz0+caqFtMeVM@paquier.xyz |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
On Thu, Nov 25, 2021 at 11:22:11AM +0530, Bharath Rupireddy wrote:
> On Thu, Nov 25, 2021 at 11:02 AM Dilip Kumar <dilipbalaut(at)gmail(dot)com> wrote:
>> I think for parsing we use getopt_long(), as per that if you use the
>> prefix of the string and that is not conflicting with any other option
>> then that is allowed. So --fo, --for all are accepted, --f will not
>> be accepted because --file and --format will conflict, --foo is also
>> not allowed because it is not a valid prefix string of any valid
>> option string.
>
> Yeah, that makes sense. Thanks.
It is worth noting that getopt_long() is a GNU extension and not
directly something defined in POSIX, but it is so popular that it
expanded everywhere. This option anme handling is quite common across
everything that uses getopt_long(), actually, and erroring on
non-exact option names would break a bunch of existing use cases as it
is possible to save some characters if getopt_long() is sure of the
uniqueness of the option found.
--
Michael
From | Date | Subject | |
---|---|---|---|
Next Message | Ken Kato | 2021-11-26 08:00:44 | Re: [PATCH] ALTER tab completion |
Previous Message | Michael Paquier | 2021-11-26 06:46:50 | Re: Deduplicate code updating ControleFile's DBState. |