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

From: Peter Eisentraut <peter(at)eisentraut(dot)org>
To: Nathan Bossart <nathandbossart(at)gmail(dot)com>, Greg Sabino Mullane <htamfids(at)gmail(dot)com>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Better error message when --single is not the first arg to postgres executable
Date: 2024-06-19 15:34:52
Message-ID: 4881958b-a56e-4f73-9203-ca0ab9e10581@eisentraut.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 19.06.24 16:04, Nathan Bossart wrote:
>> 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.

There is sort of an existing convention that --help and --version behave
like this, meaning they act immediately and exit without considering
other arguments.

I'm not really sure all this here is worth solving. I think requiring
things like --single or --boot to be first seems ok, and the
alternatives just make things more complicated.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Peter Eisentraut 2024-06-19 15:44:45 Re: What is a typical precision of gettimeofday()?
Previous Message jian he 2024-06-19 15:29:39 Re: SQL/JSON query functions context_item doc entry and type requirement