Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit2288d64

Browse files
committed
Convert backslash_quote guc to use enum.
1 parentd672ea6 commit2288d64

File tree

2 files changed

+29
-14
lines changed

2 files changed

+29
-14
lines changed

‎src/backend/utils/misc/guc.c

Lines changed: 27 additions & 12 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.444 2008/04/0408:33:15 mha Exp $
13+
* $PostgreSQL: pgsql/src/backend/utils/misc/guc.c,v 1.445 2008/04/0411:47:19 mha Exp $
1414
*
1515
*--------------------------------------------------------------------
1616
*/
@@ -153,7 +153,6 @@ static bool assign_stage_log_stats(bool newval, bool doit, GucSource source);
153153
staticboolassign_log_stats(boolnewval,booldoit,GucSourcesource);
154154
staticboolassign_transaction_read_only(boolnewval,booldoit,GucSourcesource);
155155
staticconstchar*assign_canonical_path(constchar*newval,booldoit,GucSourcesource);
156-
staticconstchar*assign_backslash_quote(constchar*newval,booldoit,GucSourcesource);
157156
staticconstchar*assign_timezone_abbreviations(constchar*newval,booldoit,GucSourcesource);
158157
staticconstchar*show_archive_command(void);
159158
staticboolassign_tcp_keepalives_idle(intnewval,booldoit,GucSourcesource);
@@ -253,6 +252,23 @@ static const struct config_enum_entry xmloption_options[] = {
253252
{NULL,0}
254253
};
255254

255+
/*
256+
* Although only "on", "off", and "safe_encoding" are documented, we
257+
* accept all the likely variants of "on" and "off".
258+
*/
259+
staticconststructconfig_enum_entrybackslash_quote_options[]= {
260+
{"safe_encoding",BACKSLASH_QUOTE_SAFE_ENCODING},
261+
{"on",BACKSLASH_QUOTE_ON},
262+
{"off",BACKSLASH_QUOTE_OFF},
263+
{"true",BACKSLASH_QUOTE_ON},
264+
{"false",BACKSLASH_QUOTE_OFF},
265+
{"yes",BACKSLASH_QUOTE_ON},
266+
{"no",BACKSLASH_QUOTE_OFF},
267+
{"1",BACKSLASH_QUOTE_ON},
268+
{"0",BACKSLASH_QUOTE_OFF},
269+
{NULL,0}
270+
};
271+
256272
/*
257273
* GUC option variables that are exported from this module
258274
*/
@@ -311,7 +327,6 @@ static char *syslog_ident_str;
311327
staticboolphony_autocommit;
312328
staticboolsession_auth_is_superuser;
313329
staticdoublephony_random_seed;
314-
staticchar*backslash_quote_string;
315330
staticchar*client_encoding_string;
316331
staticchar*datestyle_string;
317332
staticchar*locale_collate;
@@ -1959,15 +1974,6 @@ static struct config_string ConfigureNamesString[] =
19591974
"",NULL,show_archive_command
19601975
},
19611976

1962-
{
1963-
{"backslash_quote",PGC_USERSET,COMPAT_OPTIONS_PREVIOUS,
1964-
gettext_noop("Sets whether \"\\'\" is allowed in string literals."),
1965-
gettext_noop("Valid values are ON, OFF, and SAFE_ENCODING.")
1966-
},
1967-
&backslash_quote_string,
1968-
"safe_encoding",assign_backslash_quote,NULL
1969-
},
1970-
19711977
{
19721978
{"client_encoding",PGC_USERSET,CLIENT_CONN_LOCALE,
19731979
gettext_noop("Sets the client's character set encoding."),
@@ -2419,6 +2425,15 @@ static struct config_string ConfigureNamesString[] =
24192425

24202426
staticstructconfig_enumConfigureNamesEnum[]=
24212427
{
2428+
{
2429+
{"backslash_quote",PGC_USERSET,COMPAT_OPTIONS_PREVIOUS,
2430+
gettext_noop("Sets whether \"\\'\" is allowed in string literals."),
2431+
gettext_noop("Valid values are ON, OFF, and SAFE_ENCODING.")
2432+
},
2433+
&backslash_quote,
2434+
BACKSLASH_QUOTE_SAFE_ENCODING,backslash_quote_options,NULL,NULL
2435+
},
2436+
24222437
{
24232438
{"client_min_messages",PGC_USERSET,LOGGING_WHEN,
24242439
gettext_noop("Sets the message levels that are sent to the client."),

‎src/include/parser/gramparse.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
88
* Portions Copyright (c) 1994, Regents of the University of California
99
*
10-
* $PostgreSQL: pgsql/src/include/parser/gramparse.h,v 1.40 2008/01/01 19:45:58 momjian Exp $
10+
* $PostgreSQL: pgsql/src/include/parser/gramparse.h,v 1.41 2008/04/04 11:47:19 mha Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -35,7 +35,7 @@ typedef enum
3535
}BackslashQuoteType;
3636

3737
/* GUC variables in scan.l (every one of these is a bad idea :-() */
38-
externBackslashQuoteTypebackslash_quote;
38+
externintbackslash_quote;
3939
externboolescape_string_warning;
4040
externboolstandard_conforming_strings;
4141

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp