From 159e0db4d7da647ca6d9153250c60a744517ab3e Mon Sep 17 00:00:00 2001
From: Peter Eisentraut <peter_e@gmx.net>
Date: Fri, 25 Sep 2015 09:14:50 -0400
Subject: [PATCH] Group cluster_name and update_process_title settings together

---
 doc/src/sgml/config.sgml                      | 97 +++++++++++++++------------
 src/backend/utils/misc/guc.c                  |  4 +-
 src/backend/utils/misc/postgresql.conf.sample |  6 +-
 src/include/utils/guc_tables.h                |  1 +
 4 files changed, 62 insertions(+), 46 deletions(-)

diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index c8ec219..593b8fd 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -4345,30 +4345,6 @@ <title>What To Log</title>
       </listitem>
      </varlistentry>
 
-     <varlistentry id="guc-cluster-name" xreflabel="cluster_name">
-      <term><varname>cluster_name</varname> (<type>string</type>)
-      <indexterm>
-       <primary><varname>cluster_name</> configuration parameter</primary>
-      </indexterm>
-      </term>
-      <listitem>
-       <para>
-        Sets the cluster name that appears in the process title for all
-        processes in this cluster. The name can be any string of less than
-        <symbol>NAMEDATALEN</> characters (64 characters in a standard
-        build). Only printable ASCII characters may be used in the
-        <varname>cluster_name</varname> value. Other characters will be
-        replaced with question marks (<literal>?</literal>).  No name is shown
-        if this parameter is set to the empty string <literal>''</> (which is
-        the default). This parameter can only be set at server start.
-       </para>
-       <para>
-        The process title is typically viewed using programs like
-        <application>ps</> or, on Windows, <application>Process Explorer</>.
-       </para>
-      </listitem>
-     </varlistentry>
-
      <varlistentry>
       <term><varname>debug_print_parse</varname> (<type>boolean</type>)
       <indexterm>
@@ -4956,9 +4932,61 @@ <title>Using CSV-Format Log Output</title>
         </listitem>
         </orderedlist>
       </para>
-
     </sect2>
-   </sect1>
+
+   <sect2>
+    <title>Process Title</title>
+
+    <para>
+     These settings control how the process title as seen
+     by <command>ps</command> is modified.  See <xref linkend="monitoring-ps">
+     for details.
+    </para>
+
+    <variablelist>
+     <varlistentry id="guc-cluster-name" xreflabel="cluster_name">
+      <term><varname>cluster_name</varname> (<type>string</type>)
+      <indexterm>
+       <primary><varname>cluster_name</> configuration parameter</primary>
+      </indexterm>
+      </term>
+      <listitem>
+       <para>
+        Sets the cluster name that appears in the process title for all
+        processes in this cluster. The name can be any string of less than
+        <symbol>NAMEDATALEN</> characters (64 characters in a standard
+        build). Only printable ASCII characters may be used in the
+        <varname>cluster_name</varname> value. Other characters will be
+        replaced with question marks (<literal>?</literal>).  No name is shown
+        if this parameter is set to the empty string <literal>''</> (which is
+        the default). This parameter can only be set at server start.
+       </para>
+       <para>
+        The process title is typically viewed using programs like
+        <application>ps</> or, on Windows, <application>Process Explorer</>.
+       </para>
+      </listitem>
+     </varlistentry>
+
+     <varlistentry id="guc-update-process-title" xreflabel="update_process_title">
+      <term><varname>update_process_title</varname> (<type>boolean</type>)
+      <indexterm>
+       <primary><varname>update_process_title</> configuration parameter</primary>
+      </indexterm>
+      </term>
+      <listitem>
+       <para>
+        Enables updating of the process title every time a new SQL command
+        is received by the server.  The process title is typically viewed
+        by the <command>ps</> command,
+        or in Windows by using the <application>Process Explorer</>.
+        Only superusers can change this setting.
+       </para>
+      </listitem>
+     </varlistentry>
+    </variablelist>
+   </sect2>
+  </sect1>
 
    <sect1 id="runtime-config-statistics">
     <title>Run-time Statistics</title>
@@ -5076,23 +5104,6 @@ <title>Query and Index Statistics Collector</title>
       </listitem>
      </varlistentry>
 
-     <varlistentry id="guc-update-process-title" xreflabel="update_process_title">
-      <term><varname>update_process_title</varname> (<type>boolean</type>)
-      <indexterm>
-       <primary><varname>update_process_title</> configuration parameter</primary>
-      </indexterm>
-      </term>
-      <listitem>
-       <para>
-        Enables updating of the process title every time a new SQL command
-        is received by the server.  The process title is typically viewed
-        by the <command>ps</> command,
-        or in Windows by using the <application>Process Explorer</>.
-        Only superusers can change this setting.
-       </para>
-      </listitem>
-     </varlistentry>
-
      <varlistentry id="guc-stats-temp-directory" xreflabel="stats_temp_directory">
       <term><varname>stats_temp_directory</varname> (<type>string</type>)
       <indexterm>
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 3d0eb2d..b0554fb 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -1181,7 +1181,7 @@ static struct config_bool ConfigureNamesBool[] =
 	},
 
 	{
-		{"update_process_title", PGC_SUSET, STATS_COLLECTOR,
+		{"update_process_title", PGC_SUSET, PROCESS_TITLE,
 			gettext_noop("Updates the process title to show the active SQL command."),
 			gettext_noop("Enables updating of the process title every time a new SQL command is received by the server.")
 		},
@@ -3366,7 +3366,7 @@ static struct config_string ConfigureNamesString[] =
 	},
 
 	{
-		{"cluster_name", PGC_POSTMASTER, LOGGING_WHAT,
+		{"cluster_name", PGC_POSTMASTER, PROCESS_TITLE,
 			gettext_noop("Sets the name of the cluster which is included in the process title."),
 			NULL,
 			GUC_IS_NAME
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index 412e5c2..18c433b 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -443,8 +443,13 @@
 					# than the specified size in kilobytes;
 					# -1 disables, 0 logs all temp files
 #log_timezone = 'GMT'
+
+
+# - Process Title -
+
 #cluster_name = ''			# added to process titles if nonempty
 					# (change requires restart)
+#update_process_title = on
 
 
 #------------------------------------------------------------------------------
@@ -458,7 +463,6 @@
 #track_io_timing = off
 #track_functions = none			# none, pl, all
 #track_activity_query_size = 1024	# (change requires restart)
-#update_process_title = on
 #stats_temp_directory = 'pg_stat_tmp'
 
 
diff --git a/src/include/utils/guc_tables.h b/src/include/utils/guc_tables.h
index 7a58ddb..8da2e78 100644
--- a/src/include/utils/guc_tables.h
+++ b/src/include/utils/guc_tables.h
@@ -81,6 +81,7 @@ enum config_group
 	LOGGING_WHERE,
 	LOGGING_WHEN,
 	LOGGING_WHAT,
+	PROCESS_TITLE,
 	STATS,
 	STATS_MONITORING,
 	STATS_COLLECTOR,
-- 
2.5.3

