diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 4e2bd4c..7abaec4 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -75,6 +75,7 @@ #include "utils/builtins.h" #include "utils/bytea.h" #include "utils/guc_tables.h" +#include "utils/guc_values.h" #include "utils/memutils.h" #include "utils/pg_locale.h" #include "utils/plancache.h" @@ -3254,13 +3255,13 @@ static struct config_string ConfigureNamesString[] = { {"log_destination", PGC_SIGHUP, LOGGING_WHERE, gettext_noop("Sets the destination for server log output."), - gettext_noop("Valid values are combinations of \"stderr\", " - "\"syslog\", \"csvlog\", and \"eventlog\", " - "depending on the platform."), + gettext_noop("Valid values are combinations of \"" GUCV_STDERR + "\", \"" GUCV_SYSLOG "\", \"" GUCV_CSVLOG "\", and " + "\"" GUCV_EVENTLOG "\", depending on the platform."), GUC_LIST_INPUT }, &Log_destination_string, - "stderr", + GUCV_STDERR, check_log_destination, assign_log_destination, NULL }, { @@ -9900,16 +9901,16 @@ check_log_destination(char **newval, void **extra, GucSource source) { char *tok = (char *) lfirst(l); - if (pg_strcasecmp(tok, "stderr") == 0) + if (pg_strcasecmp(tok, GUCV_STDERR) == 0) newlogdest |= LOG_DESTINATION_STDERR; - else if (pg_strcasecmp(tok, "csvlog") == 0) + else if (pg_strcasecmp(tok, GUCV_CSVLOG) == 0) newlogdest |= LOG_DESTINATION_CSVLOG; #ifdef HAVE_SYSLOG - else if (pg_strcasecmp(tok, "syslog") == 0) + else if (pg_strcasecmp(tok, GUCV_SYSLOG) == 0) newlogdest |= LOG_DESTINATION_SYSLOG; #endif #ifdef WIN32 - else if (pg_strcasecmp(tok, "eventlog") == 0) + else if (pg_strcasecmp(tok, GUCV_EVENTLOG) == 0) newlogdest |= LOG_DESTINATION_EVENTLOG; #endif else diff --git a/src/include/utils/guc_values.h b/src/include/utils/guc_values.h new file mode 100644 index 0000000..cd26b5a --- /dev/null +++ b/src/include/utils/guc_values.h @@ -0,0 +1,22 @@ +/*-------------------------------------------------------------------- + * guc_values.h + * + * User-supplied GUC configuration values which are tested against + * user-supplied function parameters. + * + * Copyright (c) 2016, PostgreSQL Global Development Group + * + * src/include/utils/guc_values.h + *-------------------------------------------------------------------- + */ + +#ifndef GUC_VALUES_H +#define GUC_VALUES_H + +/* log_destination values */ +#define GUCV_CSVLOG "csvlog" +#define GUCV_EVENTLOG "eventlog" +#define GUCV_STDERR "stderr" +#define GUCV_SYSLOG "syslog" + +#endif /* GUC_VALUES_H */