On Thu, May 16, 2024 at 4:11 PM Michael Paquier <mich...@paquier.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.

Reply via email to