Re: Postgres and --config-file option

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Michael Paquier <michael(at)paquier(dot)xyz>
Cc: Aleksander Alekseev <aleksander(at)timescale(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Jelte Fennema-Nio <postgres(at)jeltef(dot)nl>, Peter Eisentraut <peter(at)eisentraut(dot)org>, Nathan Bossart <nathandbossart(at)gmail(dot)com>, Alvaro Herrera <alvherre(at)alvh(dot)no-ip(dot)org>
Subject: Re: Postgres and --config-file option
Date: 2024-05-16 23:38:28
Message-ID: CAKFQuwbF_h+T4BT7w+RFMC8ruJEgEMj=zC_u4YJXPU5ZKe+onA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, May 16, 2024 at 4:11 PM Michael Paquier <michael(at)paquier(dot)xyz> wrote:

> On Thu, May 16, 2024 at 11:57:10AM +0300, Aleksander Alekseev wrote:
> > I propose my original v1 patch for correcting the --help output of
> > 'postgres' too. I agree with the above comments that corresponding
> > changes in v4 became somewhat unwieldy.
>
> Thanks for compiling the rest.
>
> - printf(_(" --NAME=VALUE set run-time parameter\n"));
> + printf(_(" --NAME=VALUE set run-time parameter, a shorter form
> of -c\n"));
>
> This part with cross-references in the output is still meh to me, for
> same reason as for the doc changes I've argued to discard upthread.
>

I'm fine with leaving these alone. If we did change this I'd want to
change both, not just --NAME.

> write_stderr("%s does not know where to find the server
> configuration file.\n"
> - "You must specify the --config-file or -D invocation
> "
> + "You must specify the --config-file (or equivalent
> -c) or -D invocation "
>
>
I would rather just do this:

diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 3fb6803998..f827086489 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -1828,8 +1828,8 @@ SelectConfigFiles(const char *userDoption, const char
*progname)
else
{
write_stderr("%s does not know where to find the server
configuration file.\n"
- "You must specify the
--config-file or -D invocation "
- "option or set the PGDATA
environment variable.\n",
+ "You must specify either the
config_file run-time parameter or "
+ "provide the database directory\n",
progname);
return false;
}

Both "run-time parameter" and "database directory" are words present in the
help and the user can find the correct argument if that is the option they
want to use. The removal of the mention of the PGDATA environment variable
doesn't seem to be a great loss here. This error message doesn't seem to
be the correct place to teach the user about all of their options so long
as they choose to read the documentation they learn about them there; and
we need not prescribe the specific means by which they supply either of
those pieces of information - which is the norm. If someone simply runs
"postgres" at the command line this message and --help gives them
sufficient information to proceed.

David J.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Michael Paquier 2024-05-16 23:55:07 Re: Fix src/test/subscription/t/029_on_error.pl test when wal_debug is enabled
Previous Message Jeff Davis 2024-05-16 23:22:35 Re: SQL:2011 application time