On Tue, Oct 25, 2011 at 1:05 PM, Magnus Hagander <[email protected]> wrote:
> Support configurable eventlog application names on Windows
>
> This allows different instances to use the eventlog with different
> identifiers, by setting the event_source GUC, similar to how
> syslog_ident works.
>

if i uncomment event_source in a linux env i get this error:
"""
LOG:  unrecognized configuration parameter "event_source" in file
"/usr/local/pgsql/9.2/data/postgresql.conf" line 326
FATAL:  configuration file "/usr/local/pgsql/9.2/data/postgresql.conf"
contains errors
"""

this is because the definition of the GUC is inside an #ifdef, but the
error message is not very informative...
so, i tried to add a check_event_source (attached) and the error now
looks like this

"""
LOG:  22023: event_source can only be setted in windows builds
LOCATION:  call_string_check_hook, guc.c:8172
FATAL:  XX000: failed to initialize event_source to "PostgreSQL"
LOCATION:  InitializeOneGUCOption, guc.c:3959
"""

-- 
Jaime Casanova         www.2ndQuadrant.com
Professional PostgreSQL: Soporte 24x7 y capacitación
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c
new file mode 100644
index 0b1c912..e7d4b85
*** a/src/backend/utils/misc/guc.c
--- b/src/backend/utils/misc/guc.c
*************** static int	syslog_facility = 0;
*** 177,182 ****
--- 177,183 ----
  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_event_source(char **newval, void **extra, GucSource source);
  static bool check_temp_buffers(int *newval, void **extra, GucSource source);
  static bool check_phony_autocommit(bool *newval, void **extra, GucSource source);
  static bool check_debug_assertions(bool *newval, void **extra, GucSource source);
*************** static struct config_string ConfigureNam
*** 2820,2826 ****
  		NULL, assign_syslog_ident, NULL
  	},
  
- #ifdef WIN32
  	{
  		{"event_source", PGC_POSTMASTER, LOGGING_WHERE,
  			gettext_noop("Sets the application name used to identify"
--- 2821,2826 ----
*************** static struct config_string ConfigureNam
*** 2829,2837 ****
  		},
  		&event_source,
  		"PostgreSQL",
! 		NULL, NULL, NULL
  	},
- #endif
  
  	{
  		{"TimeZone", PGC_USERSET, CLIENT_CONN_LOCALE,
--- 2829,2836 ----
  		},
  		&event_source,
  		"PostgreSQL",
! 		check_event_source, NULL, NULL
  	},
  
  	{
  		{"TimeZone", PGC_USERSET, CLIENT_CONN_LOCALE,
*************** assign_syslog_ident(const char *newval,
*** 8301,8306 ****
--- 8300,8315 ----
  	/* Without syslog support, it will always be set to "none", so ignore */
  }
  
+ static bool
+ check_event_source(char **newval, void **extra, GucSource source)
+ {
+ #ifndef WIN32
+ 	GUC_check_errmsg("event_source can only be setted in windows builds");
+ 	return false;
+ #endif
+ 
+ 	return true;
+ }
  
  static void
  assign_session_replication_role(int newval, void *extra)
-- 
Sent via pgsql-committers mailing list ([email protected])
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-committers

Reply via email to