1
0
mirror of https://github.com/postgres/postgres.git synced 2025-09-03 15:22:11 +03:00

Add GUC option log_error_verbosity to control which fields of error

reports get put into the postmaster log.  Options are TERSE, DEFAULT,
VERBOSE, with the same behavior as implemented on the client side in
libpq.
This commit is contained in:
Tom Lane
2003-06-30 16:47:02 +00:00
parent a3cac5a3bf
commit 219e29784d
6 changed files with 148 additions and 71 deletions

View File

@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.132 2003/06/27 19:08:38 tgl Exp $
* $Header: /cvsroot/pgsql/src/backend/utils/misc/guc.c,v 1.133 2003/06/30 16:47:01 tgl Exp $
*
*--------------------------------------------------------------------
*/
@@ -94,6 +94,8 @@ static const char *assign_min_error_statement(const char *newval, bool doit,
bool interactive);
static const char *assign_msglvl(int *var, const char *newval,
bool doit, bool interactive);
static const char *assign_log_error_verbosity(const char *newval, bool doit,
bool interactive);
static bool assign_phony_autocommit(bool newval, bool doit, bool interactive);
@@ -134,9 +136,10 @@ int client_min_messages = NOTICE;
* cases provide the value for SHOW to display. The real state is elsewhere
* and is kept in sync by assign_hooks.
*/
static char *log_min_error_statement_str;
static char *log_min_messages_str;
static char *client_min_messages_str;
static char *log_min_messages_str;
static char *log_error_verbosity_str;
static char *log_min_error_statement_str;
static bool phony_autocommit;
static bool session_auth_is_superuser;
static double phony_random_seed;
@@ -820,6 +823,16 @@ static struct config_string
"notice", assign_client_min_messages, NULL
},
{
{"log_min_messages", PGC_SUSET}, &log_min_messages_str,
"notice", assign_log_min_messages, NULL
},
{
{"log_error_verbosity", PGC_SUSET}, &log_error_verbosity_str,
"default", assign_log_error_verbosity, NULL
},
{
{"log_min_error_statement", PGC_SUSET}, &log_min_error_statement_str,
"panic", assign_min_error_statement, NULL
@@ -909,11 +922,6 @@ static struct config_string
PG_VERSION, NULL, NULL
},
{
{"log_min_messages", PGC_SUSET}, &log_min_messages_str,
"notice", assign_log_min_messages, NULL
},
/* Not for general use --- used by SET SESSION AUTHORIZATION */
{
{"session_authorization", PGC_USERSET, GUC_NO_SHOW_ALL | GUC_NO_RESET_ALL},
@@ -3468,6 +3476,29 @@ assign_msglvl(int *var, const char *newval, bool doit, bool interactive)
return newval; /* OK */
}
static const char *
assign_log_error_verbosity(const char *newval, bool doit, bool interactive)
{
if (strcasecmp(newval, "terse") == 0)
{
if (doit)
Log_error_verbosity = PGERROR_TERSE;
}
else if (strcasecmp(newval, "default") == 0)
{
if (doit)
Log_error_verbosity = PGERROR_DEFAULT;
}
else if (strcasecmp(newval, "verbose") == 0)
{
if (doit)
Log_error_verbosity = PGERROR_VERBOSE;
}
else
return NULL; /* fail */
return newval; /* OK */
}
static bool
assign_phony_autocommit(bool newval, bool doit, bool interactive)
{