提交 7c63d0c7 编写于 作者: T Tom Lane

Change a couple of ill-advised uses of INFO elog level to WARNINGs; in

particular this allows EmitWarningsOnPlaceholders messages to show up in the
postmaster log by default.  Update elog.h comment to make it clearer what INFO
is for, and fix one example in the SGML docs that was misusing it.  Per my
gripe of yesterday.
上级 229bffed
<!-- $PostgreSQL: pgsql/doc/src/sgml/trigger.sgml,v 1.53 2008/12/07 23:46:39 alvherre Exp $ -->
<!-- $PostgreSQL: pgsql/doc/src/sgml/trigger.sgml,v 1.54 2009/01/06 16:39:52 tgl Exp $ -->
<chapter id="triggers">
<title>Triggers</title>
......@@ -603,13 +603,13 @@ trigf(PG_FUNCTION_ARGS)
/* connect to SPI manager */
if ((ret = SPI_connect()) < 0)
elog(INFO, "trigf (fired %s): SPI_connect returned %d", when, ret);
elog(ERROR, "trigf (fired %s): SPI_connect returned %d", when, ret);
/* get number of rows in table */
ret = SPI_exec("SELECT count(*) FROM ttest", 0);
if (ret < 0)
elog(NOTICE, "trigf (fired %s): SPI_exec returned %d", when, ret);
elog(ERROR, "trigf (fired %s): SPI_exec returned %d", when, ret);
/* count(*) returns int8, so be careful to convert */
i = DatumGetInt64(SPI_getbinval(SPI_tuptable->vals[0],
......
......@@ -10,7 +10,7 @@
* Written by Peter Eisentraut <peter_e@gmx.net>.
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.489 2009/01/05 13:23:33 tgl Exp $
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.490 2009/01/06 16:39:52 tgl Exp $
*
*--------------------------------------------------------------------
*/
......@@ -4541,7 +4541,7 @@ set_config_option(const char *name, const char *value,
elevel = IsUnderPostmaster ? DEBUG3 : LOG;
}
else if (source == PGC_S_DATABASE || source == PGC_S_USER)
elevel = INFO;
elevel = WARNING;
else
elevel = ERROR;
......@@ -5904,22 +5904,21 @@ DefineCustomEnumVariable(const char *name,
void
EmitWarningsOnPlaceholders(const char *className)
{
struct config_generic **vars = guc_variables;
struct config_generic **last = vars + num_guc_variables;
int nameLen = strlen(className);
int classLen = strlen(className);
int i;
while (vars < last)
for (i = 0; i < num_guc_variables; i++)
{
struct config_generic *var = *vars++;
struct config_generic *var = guc_variables[i];
if ((var->flags & GUC_CUSTOM_PLACEHOLDER) != 0 &&
strncmp(className, var->name, nameLen) == 0 &&
var->name[nameLen] == GUC_QUALIFIER_SEPARATOR)
strncmp(className, var->name, classLen) == 0 &&
var->name[classLen] == GUC_QUALIFIER_SEPARATOR)
{
ereport(INFO,
ereport(WARNING,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("unrecognized configuration parameter \"%s\"", var->name)));
errmsg("unrecognized configuration parameter \"%s\"",
var->name)));
}
}
}
......@@ -5952,7 +5951,6 @@ GetPGVariableResultDesc(const char *name)
TEXTOID, -1, 0);
TupleDescInitEntry(tupdesc, (AttrNumber) 3, "description",
TEXTOID, -1, 0);
}
else
{
......
......@@ -7,7 +7,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
* $PostgreSQL: pgsql/src/include/utils/elog.h,v 1.98 2009/01/01 17:24:02 momjian Exp $
* $PostgreSQL: pgsql/src/include/utils/elog.h,v 1.99 2009/01/06 16:39:52 tgl Exp $
*
*-------------------------------------------------------------------------
*/
......@@ -28,11 +28,12 @@
#define COMMERROR 16 /* Client communication problems; same as LOG
* for server reporting, but never sent to
* client. */
#define INFO 17 /* Informative messages that are always sent
* to client; is not affected by
* client_min_messages */
#define INFO 17 /* Messages specifically requested by user
* (eg VACUUM VERBOSE output); always sent to
* client regardless of client_min_messages,
* but by default not sent to server log. */
#define NOTICE 18 /* Helpful messages to users about query
* operation; sent to client and server log
* operation; sent to client and server log
* by default. */
#define WARNING 19 /* Warnings. NOTICE is for expected messages
* like implicit sequence creation by SERIAL.
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册