From 2f1b33486fd45a70934f9c05b45be841c2fff6b7 Mon Sep 17 00:00:00 2001
From: Aleksander Alekseev <aleksander@timescale.com>
Date: Mon, 15 Jan 2024 14:19:50 +0300
Subject: [PATCH v1] Clarify error message about specifying --config-file

When running without any arguments 'postgres' suggests to specify either
--config-file or -D option. This is somewhat confusing since --config-file
is a GUC and thus not directly described in the --help message.

This is a humble attempt to reduce the amount of confusion a bit.

Aleksander Alekseev. Reviewed by Nathan Bossart and David Johnston.
Reported by Alexey Palazhchenko.

Discussion: https://postgr.es/m/CAJ7c6TMkuLiLfrA%2BEFCPYfhXoMKRxxssB5c86%2Bibxfaz6%2B%3DSdg%40mail.gmail.com
---
 src/backend/main/main.c      | 2 +-
 src/backend/utils/misc/guc.c | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/src/backend/main/main.c b/src/backend/main/main.c
index c32a74aca4..53414275e3 100644
--- a/src/backend/main/main.c
+++ b/src/backend/main/main.c
@@ -347,7 +347,7 @@ help(const char *progname)
 	printf(_("  -s                 show statistics after each query\n"));
 	printf(_("  -S WORK-MEM        set amount of memory for sorts (in kB)\n"));
 	printf(_("  -V, --version      output version information, then exit\n"));
-	printf(_("  --NAME=VALUE       set run-time parameter\n"));
+	printf(_("  --NAME=VALUE       set run-time parameter, a shorter form of -c\n"));
 	printf(_("  --describe-config  describe configuration parameters, then exit\n"));
 	printf(_("  -?, --help         show this help, then exit\n"));
 
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 8f65ef3d89..297eb1af4f 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -1822,7 +1822,7 @@ 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 "
+					 "You must specify the --config-file (or equivalent -c) or -D invocation "
 					 "option or set the PGDATA environment variable.\n",
 					 progname);
 		return false;
-- 
2.43.0

