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

Commit2e68077

Browse files
committed
Refactor pg_set_regex_collation() for clarity.
Discussion:https://postgr.es/m/63409030-2746-462e-beac-759bd43032ce@proxel.seReviewed-by: Andreas Karlsson
1 parentda87dc0 commit2e68077

File tree

1 file changed

+19
-15
lines changed

1 file changed

+19
-15
lines changed

‎src/backend/regex/regc_pg_locale.c

Lines changed: 19 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -261,29 +261,33 @@ pg_set_regex_collation(Oid collation)
261261
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
262262
errmsg("nondeterministic collations are not supported for regular expressions")));
263263

264+
if (pg_regex_locale&&pg_regex_locale->provider==COLLPROVIDER_BUILTIN)
265+
{
266+
Assert(GetDatabaseEncoding()==PG_UTF8);
267+
pg_regex_strategy=PG_REGEX_BUILTIN;
268+
}
264269
#ifdefUSE_ICU
265-
if (pg_regex_locale&&pg_regex_locale->provider==COLLPROVIDER_ICU)
270+
elseif (pg_regex_locale&&pg_regex_locale->provider==COLLPROVIDER_ICU)
271+
{
266272
pg_regex_strategy=PG_REGEX_LOCALE_ICU;
267-
else
273+
}
268274
#endif
269-
if (GetDatabaseEncoding()==PG_UTF8)
275+
else
270276
{
271-
if (pg_regex_locale)
277+
if (GetDatabaseEncoding()==PG_UTF8)
272278
{
273-
if (pg_regex_locale->provider==COLLPROVIDER_BUILTIN)
274-
pg_regex_strategy=PG_REGEX_BUILTIN;
275-
else
279+
if (pg_regex_locale)
276280
pg_regex_strategy=PG_REGEX_LOCALE_WIDE_L;
281+
else
282+
pg_regex_strategy=PG_REGEX_LOCALE_WIDE;
277283
}
278284
else
279-
pg_regex_strategy=PG_REGEX_LOCALE_WIDE;
280-
}
281-
else
282-
{
283-
if (pg_regex_locale)
284-
pg_regex_strategy=PG_REGEX_LOCALE_1BYTE_L;
285-
else
286-
pg_regex_strategy=PG_REGEX_LOCALE_1BYTE;
285+
{
286+
if (pg_regex_locale)
287+
pg_regex_strategy=PG_REGEX_LOCALE_1BYTE_L;
288+
else
289+
pg_regex_strategy=PG_REGEX_LOCALE_1BYTE;
290+
}
287291
}
288292

289293
pg_regex_collation=collation;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp