On ons, 2009-08-26 at 22:13 -0400, Tom Lane wrote:
> Seems to me it would be too chatty to be useful, at least for people who
> set more than one or two things in postgresql.conf.  Would it be that
> hard to track which values actually changed?  Without having looked at
> the code, I'm thinking that much of the infrastructure must be there
> already now that we have support for undoing commented-out settings.

Found an easy solution; see attached patch.

On a related note, I suggest reverting or revising this logging change:
http://git.postgresql.org/gitweb?p=postgresql.git;a=commitdiff;h=293c816e4aad8e760bcb4eaba0aa16da0ccd2d04
Putting the reason for an error or warning into the detail part is not
acceptable style, IMO.
Index: src/backend/utils/misc/guc-file.l
===================================================================
RCS file: /cvsroot/pgsql/src/backend/utils/misc/guc-file.l,v
retrieving revision 1.59
diff -u -3 -p -r1.59 guc-file.l
--- src/backend/utils/misc/guc-file.l	9 Apr 2009 14:21:02 -0000	1.59
+++ src/backend/utils/misc/guc-file.l	28 Aug 2009 21:30:56 -0000
@@ -283,6 +283,10 @@ ProcessConfigFile(GucContext context)
 		/* Now we can re-apply the wired-in default */
 		set_config_option(gconf->name, NULL, context, PGC_S_DEFAULT,
 						  GUC_ACTION_SET, true);
+		if (context == PGC_SIGHUP)
+			ereport(elevel,
+					(errmsg("parameter \"%s\" removed from configuration file, reset to default",
+							gconf->name)));
 	}
 
 	/*
@@ -309,9 +313,18 @@ ProcessConfigFile(GucContext context)
 	/* If we got here all the options checked out okay, so apply them. */
 	for (item = head; item; item = item->next)
 	{
+		char *pre_value;
+
+		if (context == PGC_SIGHUP)
+			pre_value = pstrdup(GetConfigOption(item->name));
+
 		if (set_config_option(item->name, item->value, context,
 			   					 PGC_S_FILE, GUC_ACTION_SET, true))
 		{
+			if (context == PGC_SIGHUP && strcmp(pre_value, GetConfigOption(item->name)) != 0)
+				ereport(elevel,
+						(errmsg("parameter \"%s\" changed to \"%s\"",
+								item->name, item->value)));
 			set_config_sourcefile(item->name, item->filename,
 								  item->sourceline);
 		}
-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to