mirror of
https://github.com/postgres/postgres.git
synced 2025-07-30 11:03:19 +03:00
Refactor pg_set_regex_collation() for clarity.
Discussion: https://postgr.es/m/63409030-2746-462e-beac-759bd43032ce@proxel.se Reviewed-by: Andreas Karlsson
This commit is contained in:
@ -261,20 +261,23 @@ pg_set_regex_collation(Oid collation)
|
|||||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||||
errmsg("nondeterministic collations are not supported for regular expressions")));
|
errmsg("nondeterministic collations are not supported for regular expressions")));
|
||||||
|
|
||||||
|
if (pg_regex_locale && pg_regex_locale->provider == COLLPROVIDER_BUILTIN)
|
||||||
|
{
|
||||||
|
Assert(GetDatabaseEncoding() == PG_UTF8);
|
||||||
|
pg_regex_strategy = PG_REGEX_BUILTIN;
|
||||||
|
}
|
||||||
#ifdef USE_ICU
|
#ifdef USE_ICU
|
||||||
if (pg_regex_locale && pg_regex_locale->provider == COLLPROVIDER_ICU)
|
else if (pg_regex_locale && pg_regex_locale->provider == COLLPROVIDER_ICU)
|
||||||
|
{
|
||||||
pg_regex_strategy = PG_REGEX_LOCALE_ICU;
|
pg_regex_strategy = PG_REGEX_LOCALE_ICU;
|
||||||
else
|
}
|
||||||
#endif
|
#endif
|
||||||
|
else
|
||||||
|
{
|
||||||
if (GetDatabaseEncoding() == PG_UTF8)
|
if (GetDatabaseEncoding() == PG_UTF8)
|
||||||
{
|
{
|
||||||
if (pg_regex_locale)
|
if (pg_regex_locale)
|
||||||
{
|
|
||||||
if (pg_regex_locale->provider == COLLPROVIDER_BUILTIN)
|
|
||||||
pg_regex_strategy = PG_REGEX_BUILTIN;
|
|
||||||
else
|
|
||||||
pg_regex_strategy = PG_REGEX_LOCALE_WIDE_L;
|
pg_regex_strategy = PG_REGEX_LOCALE_WIDE_L;
|
||||||
}
|
|
||||||
else
|
else
|
||||||
pg_regex_strategy = PG_REGEX_LOCALE_WIDE;
|
pg_regex_strategy = PG_REGEX_LOCALE_WIDE;
|
||||||
}
|
}
|
||||||
@ -285,6 +288,7 @@ pg_set_regex_collation(Oid collation)
|
|||||||
else
|
else
|
||||||
pg_regex_strategy = PG_REGEX_LOCALE_1BYTE;
|
pg_regex_strategy = PG_REGEX_LOCALE_1BYTE;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
pg_regex_collation = collation;
|
pg_regex_collation = collation;
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user