mirror of
https://github.com/postgres/postgres.git
synced 2025-07-31 22:04:40 +03:00
Validate ICU locales.
For ICU collations, ensure that the locale's language exists in ICU, and that the locale can be opened. Basic validation helps avoid minor mistakes and misspellings, which often fall back to the root locale instead of the intended locale. It's even more important to avoid such mistakes in ICU versions 54 and earlier, where the same (misspelled) locale string could fall back to different locales depending on the environment. Discussion: https://postgr.es/m/11b1eeb7e7667fdd4178497aeb796c48d26e69b9.camel@j-davis.com Discussion: https://postgr.es/m/df2efad0cae7c65180df8e5ebb709e5eb4f2a82b.camel@j-davis.com Reviewed-by: Peter Eisentraut
This commit is contained in:
@ -166,6 +166,22 @@ static const struct config_enum_entry intervalstyle_options[] = {
|
||||
{NULL, 0, false}
|
||||
};
|
||||
|
||||
static const struct config_enum_entry icu_validation_level_options[] = {
|
||||
{"disabled", -1, false},
|
||||
{"debug5", DEBUG5, false},
|
||||
{"debug4", DEBUG4, false},
|
||||
{"debug3", DEBUG3, false},
|
||||
{"debug2", DEBUG2, false},
|
||||
{"debug1", DEBUG1, false},
|
||||
{"debug", DEBUG2, true},
|
||||
{"log", LOG, false},
|
||||
{"info", INFO, true},
|
||||
{"notice", NOTICE, false},
|
||||
{"warning", WARNING, false},
|
||||
{"error", ERROR, false},
|
||||
{NULL, 0, false}
|
||||
};
|
||||
|
||||
StaticAssertDecl(lengthof(intervalstyle_options) == (INTSTYLE_ISO_8601 + 2),
|
||||
"array length mismatch");
|
||||
|
||||
@ -4643,6 +4659,16 @@ struct config_enum ConfigureNamesEnum[] =
|
||||
NULL, NULL, NULL
|
||||
},
|
||||
|
||||
{
|
||||
{"icu_validation_level", PGC_USERSET, CLIENT_CONN_LOCALE,
|
||||
gettext_noop("Log level for reporting invalid ICU locale strings."),
|
||||
NULL
|
||||
},
|
||||
&icu_validation_level,
|
||||
ERROR, icu_validation_level_options,
|
||||
NULL, NULL, NULL
|
||||
},
|
||||
|
||||
{
|
||||
{"log_error_verbosity", PGC_SUSET, LOGGING_WHAT,
|
||||
gettext_noop("Sets the verbosity of logged messages."),
|
||||
|
Reference in New Issue
Block a user