Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 7c63d0c

Browse files
committed
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.
1 parent 229bffe commit 7c63d0c

File tree

3 files changed

+20
-21
lines changed

3 files changed

+20
-21
lines changed

doc/src/sgml/trigger.sgml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
<!-- $PostgreSQL: pgsql/doc/src/sgml/trigger.sgml,v 1.53 2008/12/07 23:46:39 alvherre Exp $ -->
1+
<!-- $PostgreSQL: pgsql/doc/src/sgml/trigger.sgml,v 1.54 2009/01/06 16:39:52 tgl Exp $ -->
22

33
<chapter id="triggers">
44
<title>Triggers</title>
@@ -603,13 +603,13 @@ trigf(PG_FUNCTION_ARGS)
603603

604604
/* connect to SPI manager */
605605
if ((ret = SPI_connect()) < 0)
606-
elog(INFO, "trigf (fired %s): SPI_connect returned %d", when, ret);
606+
elog(ERROR, "trigf (fired %s): SPI_connect returned %d", when, ret);
607607

608608
/* get number of rows in table */
609609
ret = SPI_exec("SELECT count(*) FROM ttest", 0);
610610

611611
if (ret < 0)
612-
elog(NOTICE, "trigf (fired %s): SPI_exec returned %d", when, ret);
612+
elog(ERROR, "trigf (fired %s): SPI_exec returned %d", when, ret);
613613

614614
/* count(*) returns int8, so be careful to convert */
615615
i = DatumGetInt64(SPI_getbinval(SPI_tuptable->vals[0],

src/backend/utils/misc/guc.c

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
* Written by Peter Eisentraut <peter_e@gmx.net>.
1111
*
1212
* IDENTIFICATION
13-
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.489 2009/01/05 13:23:33 tgl Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.490 2009/01/06 16:39:52 tgl Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -4541,7 +4541,7 @@ set_config_option(const char *name, const char *value,
45414541
elevel = IsUnderPostmaster ? DEBUG3 : LOG;
45424542
}
45434543
else if (source == PGC_S_DATABASE || source == PGC_S_USER)
4544-
elevel = INFO;
4544+
elevel = WARNING;
45454545
else
45464546
elevel = ERROR;
45474547

@@ -5904,22 +5904,21 @@ DefineCustomEnumVariable(const char *name,
59045904
void
59055905
EmitWarningsOnPlaceholders(const char *className)
59065906
{
5907-
struct config_generic **vars = guc_variables;
5908-
struct config_generic **last = vars + num_guc_variables;
5909-
5910-
int nameLen = strlen(className);
5907+
int classLen = strlen(className);
5908+
int i;
59115909

5912-
while (vars < last)
5910+
for (i = 0; i < num_guc_variables; i++)
59135911
{
5914-
struct config_generic *var = *vars++;
5912+
struct config_generic *var = guc_variables[i];
59155913

59165914
if ((var->flags & GUC_CUSTOM_PLACEHOLDER) != 0 &&
5917-
strncmp(className, var->name, nameLen) == 0 &&
5918-
var->name[nameLen] == GUC_QUALIFIER_SEPARATOR)
5915+
strncmp(className, var->name, classLen) == 0 &&
5916+
var->name[classLen] == GUC_QUALIFIER_SEPARATOR)
59195917
{
5920-
ereport(INFO,
5918+
ereport(WARNING,
59215919
(errcode(ERRCODE_UNDEFINED_OBJECT),
5922-
errmsg("unrecognized configuration parameter \"%s\"", var->name)));
5920+
errmsg("unrecognized configuration parameter \"%s\"",
5921+
var->name)));
59235922
}
59245923
}
59255924
}
@@ -5952,7 +5951,6 @@ GetPGVariableResultDesc(const char *name)
59525951
TEXTOID, -1, 0);
59535952
TupleDescInitEntry(tupdesc, (AttrNumber) 3, "description",
59545953
TEXTOID, -1, 0);
5955-
59565954
}
59575955
else
59585956
{

src/include/utils/elog.h

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/utils/elog.h,v 1.98 2009/01/01 17:24:02 momjian Exp $
10+
* $PostgreSQL: pgsql/src/include/utils/elog.h,v 1.99 2009/01/06 16:39:52 tgl Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -28,11 +28,12 @@
2828
#define COMMERROR 16 /* Client communication problems; same as LOG
2929
* for server reporting, but never sent to
3030
* client. */
31-
#define INFO 17 /* Informative messages that are always sent
32-
* to client; is not affected by
33-
* client_min_messages */
31+
#define INFO 17 /* Messages specifically requested by user
32+
* (eg VACUUM VERBOSE output); always sent to
33+
* client regardless of client_min_messages,
34+
* but by default not sent to server log. */
3435
#define NOTICE 18 /* Helpful messages to users about query
35-
* operation; sent to client and server log
36+
* operation; sent to client and server log
3637
* by default. */
3738
#define WARNING 19 /* Warnings. NOTICE is for expected messages
3839
* like implicit sequence creation by SERIAL.

0 commit comments

Comments
 (0)