Re: Better error message when --single is not the first arg to postgres executable

Поиск
Список
Период
Сортировка
От Nathan Bossart
Тема Re: Better error message when --single is not the first arg to postgres executable
Дата
Msg-id ZnLlfMQeV1src1ot@nathan
обсуждение исходный текст
Ответ на Re: Better error message when --single is not the first arg to postgres executable  (Greg Sabino Mullane <htamfids@gmail.com>)
Ответы Re: Better error message when --single is not the first arg to postgres executable
Список pgsql-hackers
On Tue, Jun 18, 2024 at 09:42:32PM -0400, Greg Sabino Mullane wrote:
> If I am reading your patch correctly, we have lost the behavior of least
> surprise in which the first "meta" argument overrides all others:
> 
> $ bin/postgres --version --boot --extrastuff
> postgres (PostgreSQL) 16.2

Right, with the patch we fail if there are multiple such options specified:

    $ postgres --version --help
    FATAL:  multiple server modes set
    DETAIL:  Only one of --check, --boot, --describe-config, --single, --help/-?, --version/-V, -C may be set.

> What about just inlining --version and --help e.g.
> 
> else if (strcmp(argv[i], "--version") == 0 || strcmp(argv[i], "-V") == 0)
> {
>      fputs(PG_BACKEND_VERSIONSTR, stdout);
>      exit(0);
> }
> 
> I'm fine with being more persnickety about the other options; they are much
> rarer and not unixy.

That seems like it should work.  I'm not sure I agree that's the least
surprising behavior (e.g., what exactly is the user trying to tell us with
commands like "postgres --version --help --describe-config"?), but I also
don't feel too strongly about it.

-- 
nathan



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

Предыдущее
От: Ranier Vilela
Дата:
Сообщение: Re: Add pg_get_acl() function get the ACL for a database object
Следующее
От: Bertrand Drouvot
Дата:
Сообщение: Re: Avoid orphaned objects dependencies, take 3