diff options
author | Magnus Hagander | 2008-04-04 11:47:19 +0000 |
---|---|---|
committer | Magnus Hagander | 2008-04-04 11:47:19 +0000 |
commit | 81e2ec4d4c1f5818b69f49f615256a54c9f499ee (patch) | |
tree | f011d2a5374ad74be61fff281699a489654d5cdb | |
parent | f79068d7675cb6658e42cbdbcf5950afc8da0132 (diff) |
Convert backslash_quote guc to use enum.
-rw-r--r-- | src/backend/utils/misc/guc.c | 37 | ||||
-rw-r--r-- | src/include/parser/gramparse.h | 2 |
2 files changed, 27 insertions, 12 deletions
diff --git a/src/backend/utils/misc/guc.c b/src/backend/utils/misc/guc.c index 83a2fbdb0c..45a3b05fdb 100644 --- a/src/backend/utils/misc/guc.c +++ b/src/backend/utils/misc/guc.c @@ -153,7 +153,6 @@ static bool assign_stage_log_stats(bool newval, bool doit, GucSource source); static bool assign_log_stats(bool newval, bool doit, GucSource source); static bool assign_transaction_read_only(bool newval, bool doit, GucSource source); static const char *assign_canonical_path(const char *newval, bool doit, GucSource source); -static const char *assign_backslash_quote(const char *newval, bool doit, GucSource source); static const char *assign_timezone_abbreviations(const char *newval, bool doit, GucSource source); static const char *show_archive_command(void); static bool assign_tcp_keepalives_idle(int newval, bool doit, GucSource source); @@ -254,6 +253,23 @@ static const struct config_enum_entry xmloption_options[] = { }; /* + * Although only "on", "off", and "safe_encoding" are documented, we + * accept all the likely variants of "on" and "off". + */ +static const struct config_enum_entry backslash_quote_options[] = { + {"safe_encoding", BACKSLASH_QUOTE_SAFE_ENCODING}, + {"on", BACKSLASH_QUOTE_ON}, + {"off", BACKSLASH_QUOTE_OFF}, + {"true", BACKSLASH_QUOTE_ON}, + {"false", BACKSLASH_QUOTE_OFF}, + {"yes", BACKSLASH_QUOTE_ON}, + {"no", BACKSLASH_QUOTE_OFF}, + {"1", BACKSLASH_QUOTE_ON}, + {"0", BACKSLASH_QUOTE_OFF}, + {NULL, 0} +}; + +/* * GUC option variables that are exported from this module */ #ifdef USE_ASSERT_CHECKING @@ -311,7 +327,6 @@ static char *syslog_ident_str; static bool phony_autocommit; static bool session_auth_is_superuser; static double phony_random_seed; -static char *backslash_quote_string; static char *client_encoding_string; static char *datestyle_string; static char *locale_collate; @@ -1960,15 +1975,6 @@ static struct config_string ConfigureNamesString[] = }, { - {"backslash_quote", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS, - gettext_noop("Sets whether \"\\'\" is allowed in string literals."), - gettext_noop("Valid values are ON, OFF, and SAFE_ENCODING.") - }, - &backslash_quote_string, - "safe_encoding", assign_backslash_quote, NULL - }, - - { {"client_encoding", PGC_USERSET, CLIENT_CONN_LOCALE, gettext_noop("Sets the client's character set encoding."), NULL, @@ -2420,6 +2426,15 @@ static struct config_string ConfigureNamesString[] = static struct config_enum ConfigureNamesEnum[] = { { + {"backslash_quote", PGC_USERSET, COMPAT_OPTIONS_PREVIOUS, + gettext_noop("Sets whether \"\\'\" is allowed in string literals."), + gettext_noop("Valid values are ON, OFF, and SAFE_ENCODING.") + }, + &backslash_quote, + BACKSLASH_QUOTE_SAFE_ENCODING, backslash_quote_options, NULL, NULL + }, + + { {"client_min_messages", PGC_USERSET, LOGGING_WHEN, gettext_noop("Sets the message levels that are sent to the client."), gettext_noop("Valid values are DEBUG5, DEBUG4, DEBUG3, DEBUG2, " diff --git a/src/include/parser/gramparse.h b/src/include/parser/gramparse.h index 32aaf1be57..a96c7535f5 100644 --- a/src/include/parser/gramparse.h +++ b/src/include/parser/gramparse.h @@ -35,7 +35,7 @@ typedef enum } BackslashQuoteType; /* GUC variables in scan.l (every one of these is a bad idea :-() */ -extern BackslashQuoteType backslash_quote; +extern int backslash_quote; extern bool escape_string_warning; extern bool standard_conforming_strings; |