Re: pg_dump, pg_basebackup don't error out with wrong option for "--format"

Поиск
Список
Период
Сортировка
От Michael Paquier
Тема Re: pg_dump, pg_basebackup don't error out with wrong option for "--format"
Дата
Msg-id YaCEz0+caqFtMeVM@paquier.xyz
обсуждение исходный текст
Ответ на Re: pg_dump, pg_basebackup don't error out with wrong option for "--format"  (Bharath Rupireddy <bharath.rupireddyforpostgres@gmail.com>)
Список 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@gmail.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

Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Michael Paquier
Дата:
Сообщение: Re: Deduplicate code updating ControleFile's DBState.
Следующее
От: Ken Kato
Дата:
Сообщение: Re: [PATCH] ALTER tab completion