summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--doc/src/sgml/config.sgml45
-rw-r--r--src/backend/utils/error/elog.c11
-rw-r--r--src/backend/utils/misc/guc.c19
-rw-r--r--src/backend/utils/misc/postgresql.conf.sample21
4 files changed, 51 insertions, 45 deletions
diff --git a/doc/src/sgml/config.sgml b/doc/src/sgml/config.sgml
index 5189e8e26ce..54dfa14963b 100644
--- a/doc/src/sgml/config.sgml
+++ b/doc/src/sgml/config.sgml
@@ -4571,28 +4571,6 @@ local0.* /var/log/postgresql
<variablelist>
- <varlistentry id="guc-client-min-messages" xreflabel="client_min_messages">
- <term><varname>client_min_messages</varname> (<type>enum</type>)
- <indexterm>
- <primary><varname>client_min_messages</> configuration parameter</primary>
- </indexterm>
- </term>
- <listitem>
- <para>
- Controls which message levels are sent to the client.
- Valid values are <literal>DEBUG5</>,
- <literal>DEBUG4</>, <literal>DEBUG3</>, <literal>DEBUG2</>,
- <literal>DEBUG1</>, <literal>LOG</>, <literal>NOTICE</>,
- <literal>WARNING</>, <literal>ERROR</>, <literal>FATAL</>,
- and <literal>PANIC</>. Each level
- includes all the levels that follow it. The later the level,
- the fewer messages are sent. The default is
- <literal>NOTICE</>. Note that <literal>LOG</> has a different
- rank here than in <varname>log_min_messages</>.
- </para>
- </listitem>
- </varlistentry>
-
<varlistentry id="guc-log-min-messages" xreflabel="log_min_messages">
<term><varname>log_min_messages</varname> (<type>enum</type>)
<indexterm>
@@ -4610,7 +4588,7 @@ local0.* /var/log/postgresql
follow it. The later the level, the fewer messages are sent
to the log. The default is <literal>WARNING</>. Note that
<literal>LOG</> has a different rank here than in
- <varname>client_min_messages</>.
+ <xref linkend="guc-client-min-messages">.
Only superusers can change this setting.
</para>
</listitem>
@@ -5919,6 +5897,27 @@ COPY postgres_log FROM '/full/path/to/logfile.csv' WITH csv;
<title>Statement Behavior</title>
<variablelist>
+ <varlistentry id="guc-client-min-messages" xreflabel="client_min_messages">
+ <term><varname>client_min_messages</varname> (<type>enum</type>)
+ <indexterm>
+ <primary><varname>client_min_messages</> configuration parameter</primary>
+ </indexterm>
+ </term>
+ <listitem>
+ <para>
+ Controls which message levels are sent to the client.
+ Valid values are <literal>DEBUG5</>,
+ <literal>DEBUG4</>, <literal>DEBUG3</>, <literal>DEBUG2</>,
+ <literal>DEBUG1</>, <literal>LOG</>, <literal>NOTICE</>,
+ <literal>WARNING</>, and <literal>ERROR</>.
+ Each level includes all the levels that follow it. The later the level,
+ the fewer messages are sent. The default is
+ <literal>NOTICE</>. Note that <literal>LOG</> has a different
+ rank here than in <xref linkend="guc-log-min-messages">.
+ </para>
+ </listitem>
+ </varlistentry>
+
<varlistentry id="guc-search-path" xreflabel="search_path">
<term><varname>search_path</varname> (<type>string</type>)
<indexterm>
diff --git a/src/backend/utils/error/elog.c b/src/backend/utils/error/elog.c
index 7e977e8b18b..8a21f5de63e 100644
--- a/src/backend/utils/error/elog.c
+++ b/src/backend/utils/error/elog.c
@@ -472,9 +472,7 @@ errfinish(int dummy,...)
* progress, so that we can report the message before dying. (Without
* this, pq_putmessage will refuse to send the message at all, which is
* what we want for NOTICE messages, but not for fatal exits.) This hack
- * is necessary because of poor design of old-style copy protocol. Note
- * we must do this even if client is fool enough to have set
- * client_min_messages above FATAL, so don't look at output_to_client.
+ * is necessary because of poor design of old-style copy protocol.
*/
if (elevel >= FATAL && whereToSendOutput == DestRemote)
pq_endcopyout(true);
@@ -1758,12 +1756,7 @@ pg_re_throw(void)
else
edata->output_to_server = (FATAL >= log_min_messages);
if (whereToSendOutput == DestRemote)
- {
- if (ClientAuthInProgress)
- edata->output_to_client = true;
- else
- edata->output_to_client = (FATAL >= client_min_messages);
- }
+ edata->output_to_client = true;
/*
* We can use errfinish() for the rest, but we don't want it to call
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
index 0628912ed9c..5c27397ccc8 100644
--- a/src/backend/utils/misc/guc.c
+++ b/src/backend/utils/misc/guc.c
@@ -153,6 +153,7 @@ static int syslog_facility = 0;
static void assign_syslog_facility(int newval, void *extra);
static void assign_syslog_ident(const char *newval, void *extra);
static void assign_session_replication_role(int newval, void *extra);
+static bool check_client_min_messages(int *newval, void **extra, GucSource source);
static bool check_temp_buffers(int *newval, void **extra, GucSource source);
static bool check_bonjour(bool *newval, void **extra, GucSource source);
static bool check_ssl(bool *newval, void **extra, GucSource source);
@@ -3581,14 +3582,14 @@ static struct config_enum ConfigureNamesEnum[] =
},
{
- {"client_min_messages", PGC_USERSET, LOGGING_WHEN,
+ {"client_min_messages", PGC_USERSET, CLIENT_CONN_STATEMENT,
gettext_noop("Sets the message levels that are sent to the client."),
gettext_noop("Each level includes all the levels that follow it. The later"
" the level, the fewer messages are sent.")
},
&client_min_messages,
NOTICE, client_message_level_options,
- NULL, NULL, NULL
+ check_client_min_messages, NULL, NULL
},
{
@@ -9969,6 +9970,20 @@ assign_session_replication_role(int newval, void *extra)
}
static bool
+check_client_min_messages(int *newval, void **extra, GucSource source)
+{
+ /*
+ * We disallow setting client_min_messages above ERROR, because not
+ * sending an ErrorResponse message for an error breaks the FE/BE
+ * protocol. However, for backwards compatibility, we still accept FATAL
+ * or PANIC as input values, and then adjust here.
+ */
+ if (*newval > ERROR)
+ *newval = ERROR;
+ return true;
+}
+
+static bool
check_temp_buffers(int *newval, void **extra, GucSource source)
{
/*
diff --git a/src/backend/utils/misc/postgresql.conf.sample b/src/backend/utils/misc/postgresql.conf.sample
index 9a999c9359d..b6b683ec280 100644
--- a/src/backend/utils/misc/postgresql.conf.sample
+++ b/src/backend/utils/misc/postgresql.conf.sample
@@ -373,17 +373,6 @@
# - When to Log -
-#client_min_messages = notice # values in order of decreasing detail:
- # debug5
- # debug4
- # debug3
- # debug2
- # debug1
- # log
- # notice
- # warning
- # error
-
#log_min_messages = warning # values in order of decreasing detail:
# debug5
# debug4
@@ -527,6 +516,16 @@
# - Statement Behavior -
+#client_min_messages = notice # values in order of decreasing detail:
+ # debug5
+ # debug4
+ # debug3
+ # debug2
+ # debug1
+ # log
+ # notice
+ # warning
+ # error
#search_path = '"$user", public' # schema names
#default_tablespace = '' # a tablespace name, '' uses the default
#temp_tablespaces = '' # a list of tablespace names, '' uses