aboutsummaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/main/main.c1
-rw-r--r--src/backend/postmaster/postmaster.c15
-rw-r--r--src/backend/tcop/postgres.c8
3 files changed, 21 insertions, 3 deletions
diff --git a/src/backend/main/main.c b/src/backend/main/main.c
index 8d9cb9428df..b14c7318ab2 100644
--- a/src/backend/main/main.c
+++ b/src/backend/main/main.c
@@ -283,6 +283,7 @@ help(const char *progname)
#endif
printf(_(" -B NBUFFERS number of shared buffers\n"));
printf(_(" -c NAME=VALUE set run-time parameter\n"));
+ printf(_(" -C NAME return run-time parameter\n"));
printf(_(" -d 1-5 debugging level\n"));
printf(_(" -D DATADIR database directory\n"));
printf(_(" -e use European date input format (DMY)\n"));
diff --git a/src/backend/postmaster/postmaster.c b/src/backend/postmaster/postmaster.c
index 0a84d97f517..dd7493cf9dd 100644
--- a/src/backend/postmaster/postmaster.c
+++ b/src/backend/postmaster/postmaster.c
@@ -203,6 +203,8 @@ bool enable_bonjour = false;
char *bonjour_name;
bool restart_after_crash = true;
+char *output_config_variable = NULL;
+
/* PIDs of special child processes; 0 when not running */
static pid_t StartupPID = 0,
BgWriterPID = 0,
@@ -537,7 +539,7 @@ PostmasterMain(int argc, char *argv[])
* tcop/postgres.c (the option sets should not conflict) and with the
* common help() function in main/main.c.
*/
- while ((opt = getopt(argc, argv, "A:B:bc:D:d:EeFf:h:ijk:lN:nOo:Pp:r:S:sTt:W:-:")) != -1)
+ while ((opt = getopt(argc, argv, "A:B:bc:C:D:d:EeFf:h:ijk:lN:nOo:Pp:r:S:sTt:W:-:")) != -1)
{
switch (opt)
{
@@ -554,6 +556,10 @@ PostmasterMain(int argc, char *argv[])
IsBinaryUpgrade = true;
break;
+ case 'C':
+ output_config_variable = optarg;
+ break;
+
case 'D':
userDoption = optarg;
break;
@@ -728,6 +734,13 @@ PostmasterMain(int argc, char *argv[])
if (!SelectConfigFiles(userDoption, progname))
ExitPostmaster(2);
+ if (output_config_variable != NULL)
+ {
+ /* permission is handled because the user is reading inside the data dir */
+ puts(GetConfigOption(output_config_variable, false, false));
+ ExitPostmaster(0);
+ }
+
/* Verify that DataDir looks reasonable */
checkDataDir();
diff --git a/src/backend/tcop/postgres.c b/src/backend/tcop/postgres.c
index c7eac71e91e..19d94b252c2 100644
--- a/src/backend/tcop/postgres.c
+++ b/src/backend/tcop/postgres.c
@@ -3170,7 +3170,7 @@ process_postgres_switches(int argc, char *argv[], GucContext ctx)
* postmaster/postmaster.c (the option sets should not conflict) and with
* the common help() function in main/main.c.
*/
- while ((flag = getopt(argc, argv, "A:B:bc:D:d:EeFf:h:ijk:lN:nOo:Pp:r:S:sTt:v:W:-:")) != -1)
+ while ((flag = getopt(argc, argv, "A:B:bc:C:D:d:EeFf:h:ijk:lN:nOo:Pp:r:S:sTt:v:W:-:")) != -1)
{
switch (flag)
{
@@ -3187,6 +3187,10 @@ process_postgres_switches(int argc, char *argv[], GucContext ctx)
IsBinaryUpgrade = true;
break;
+ case 'C':
+ /* ignored for consistency with the postmaster */
+ break;
+
case 'D':
if (secure)
userDoption = strdup(optarg);
@@ -3272,7 +3276,7 @@ process_postgres_switches(int argc, char *argv[], GucContext ctx)
break;
case 'T':
- /* ignored for consistency with postmaster */
+ /* ignored for consistency with the postmaster */
break;
case 't':