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

Commitb0c3061

Browse files
committed
Simplify checks for deterministic collations.
Remove redundant checks for locale->collate_is_c now that we alwayshave a valid pg_locale_t.Also, remove pg_locale_deterministic() wrapper, which is no longeruseful after commite9931bf. Just check the field directly,consistent with other fields in pg_locale_t.Author: Andreas KarlssonDiscussion:https://postgr.es/m/60929555-4709-40a7-b136-bcb44cff5a3c@proxel.se
1 parent6a9fc11 commitb0c3061

File tree

7 files changed

+16
-28
lines changed

7 files changed

+16
-28
lines changed

‎src/backend/access/hash/hashfunc.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,7 @@ hashtext(PG_FUNCTION_ARGS)
279279

280280
mylocale=pg_newlocale_from_collation(collid);
281281

282-
if (pg_locale_deterministic(mylocale))
282+
if (mylocale->deterministic)
283283
{
284284
result=hash_any((unsignedchar*)VARDATA_ANY(key),
285285
VARSIZE_ANY_EXHDR(key));
@@ -334,7 +334,7 @@ hashtextextended(PG_FUNCTION_ARGS)
334334

335335
mylocale=pg_newlocale_from_collation(collid);
336336

337-
if (pg_locale_deterministic(mylocale))
337+
if (mylocale->deterministic)
338338
{
339339
result=hash_any_extended((unsignedchar*)VARDATA_ANY(key),
340340
VARSIZE_ANY_EXHDR(key),

‎src/backend/regex/regc_pg_locale.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ pg_set_regex_collation(Oid collation)
260260
{
261261
locale=pg_newlocale_from_collation(collation);
262262

263-
if (!pg_locale_deterministic(locale))
263+
if (!locale->deterministic)
264264
ereport(ERROR,
265265
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
266266
errmsg("nondeterministic collations are not supported for regular expressions")));

‎src/backend/utils/adt/like.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ GenericMatchText(const char *s, int slen, const char *p, int plen, Oid collation
151151
{
152152
pg_locale_tlocale=pg_newlocale_from_collation(collation);
153153

154-
if (!pg_locale_deterministic(locale))
154+
if (!locale->deterministic)
155155
ereport(ERROR,
156156
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
157157
errmsg("nondeterministic collations are not supported for LIKE")));
@@ -188,7 +188,7 @@ Generic_Text_IC_like(text *str, text *pat, Oid collation)
188188

189189
locale=pg_newlocale_from_collation(collation);
190190

191-
if (!pg_locale_deterministic(locale))
191+
if (!locale->deterministic)
192192
ereport(ERROR,
193193
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
194194
errmsg("nondeterministic collations are not supported for ILIKE")));

‎src/backend/utils/adt/pg_locale.c

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1415,13 +1415,6 @@ make_icu_collator(const char *iculocstr,
14151415
#endif/* not USE_ICU */
14161416
}
14171417

1418-
1419-
bool
1420-
pg_locale_deterministic(pg_locale_tlocale)
1421-
{
1422-
returnlocale->deterministic;
1423-
}
1424-
14251418
/*
14261419
* Initialize default_locale with database locale settings.
14271420
*/

‎src/backend/utils/adt/varchar.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -757,7 +757,7 @@ bpchareq(PG_FUNCTION_ARGS)
757757

758758
mylocale=pg_newlocale_from_collation(collid);
759759

760-
if (mylocale->collate_is_c||pg_locale_deterministic(mylocale))
760+
if (mylocale->deterministic)
761761
{
762762
/*
763763
* Since we only care about equality or not-equality, we can avoid all
@@ -798,7 +798,7 @@ bpcharne(PG_FUNCTION_ARGS)
798798

799799
mylocale=pg_newlocale_from_collation(collid);
800800

801-
if (mylocale->collate_is_c||pg_locale_deterministic(mylocale))
801+
if (mylocale->deterministic)
802802
{
803803
/*
804804
* Since we only care about equality or not-equality, we can avoid all
@@ -1005,7 +1005,7 @@ hashbpchar(PG_FUNCTION_ARGS)
10051005

10061006
mylocale=pg_newlocale_from_collation(collid);
10071007

1008-
if (pg_locale_deterministic(mylocale))
1008+
if (mylocale->deterministic)
10091009
{
10101010
result=hash_any((unsignedchar*)keydata,keylen);
10111011
}
@@ -1061,7 +1061,7 @@ hashbpcharextended(PG_FUNCTION_ARGS)
10611061

10621062
mylocale=pg_newlocale_from_collation(collid);
10631063

1064-
if (pg_locale_deterministic(mylocale))
1064+
if (mylocale->deterministic)
10651065
{
10661066
result=hash_any_extended((unsignedchar*)keydata,keylen,
10671067
PG_GETARG_INT64(1));

‎src/backend/utils/adt/varlena.c

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1223,7 +1223,7 @@ text_position_setup(text *t1, text *t2, Oid collid, TextPositionState *state)
12231223

12241224
mylocale=pg_newlocale_from_collation(collid);
12251225

1226-
if (!pg_locale_deterministic(mylocale))
1226+
if (!mylocale->deterministic)
12271227
ereport(ERROR,
12281228
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
12291229
errmsg("nondeterministic collations are not supported for substring searches")));
@@ -1567,7 +1567,7 @@ varstr_cmp(const char *arg1, int len1, const char *arg2, int len2, Oid collid)
15671567
result=pg_strncoll(arg1,len1,arg2,len2,mylocale);
15681568

15691569
/* Break tie if necessary. */
1570-
if (result==0&&pg_locale_deterministic(mylocale))
1570+
if (result==0&&mylocale->deterministic)
15711571
{
15721572
result=memcmp(arg1,arg2,Min(len1,len2));
15731573
if ((result==0)&& (len1!=len2))
@@ -1618,7 +1618,7 @@ texteq(PG_FUNCTION_ARGS)
16181618

16191619
mylocale=pg_newlocale_from_collation(collid);
16201620

1621-
if (pg_locale_deterministic(mylocale))
1621+
if (mylocale->deterministic)
16221622
{
16231623
Datumarg1=PG_GETARG_DATUM(0);
16241624
Datumarg2=PG_GETARG_DATUM(1);
@@ -1673,7 +1673,7 @@ textne(PG_FUNCTION_ARGS)
16731673

16741674
mylocale=pg_newlocale_from_collation(collid);
16751675

1676-
if (pg_locale_deterministic(mylocale))
1676+
if (mylocale->deterministic)
16771677
{
16781678
Datumarg1=PG_GETARG_DATUM(0);
16791679
Datumarg2=PG_GETARG_DATUM(1);
@@ -1786,7 +1786,7 @@ text_starts_with(PG_FUNCTION_ARGS)
17861786

17871787
mylocale=pg_newlocale_from_collation(collid);
17881788

1789-
if (!pg_locale_deterministic(mylocale))
1789+
if (!mylocale->deterministic)
17901790
ereport(ERROR,
17911791
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
17921792
errmsg("nondeterministic collations are not supported for substring searches")));
@@ -2200,7 +2200,7 @@ varstrfastcmp_locale(char *a1p, int len1, char *a2p, int len2, SortSupport ssup)
22002200
result=pg_strcoll(sss->buf1,sss->buf2,sss->locale);
22012201

22022202
/* Break tie if necessary. */
2203-
if (result==0&&pg_locale_deterministic(sss->locale))
2203+
if (result==0&&sss->locale->deterministic)
22042204
result=strcmp(sss->buf1,sss->buf2);
22052205

22062206
/* Cache result, perhaps saving an expensive strcoll() call next time */
@@ -2539,11 +2539,7 @@ btvarstrequalimage(PG_FUNCTION_ARGS)
25392539

25402540
locale=pg_newlocale_from_collation(collid);
25412541

2542-
if (locale->collate_is_c||
2543-
pg_locale_deterministic(locale))
2544-
PG_RETURN_BOOL(true);
2545-
else
2546-
PG_RETURN_BOOL(false);
2542+
PG_RETURN_BOOL(locale->deterministic);
25472543
}
25482544

25492545
Datum

‎src/include/utils/pg_locale.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ extern void make_icu_collator(const char *iculocstr,
108108
constchar*icurules,
109109
structpg_locale_struct*resultp);
110110

111-
externboolpg_locale_deterministic(pg_locale_tlocale);
112111
externvoidinit_database_collation(void);
113112
externpg_locale_tpg_newlocale_from_collation(Oidcollid);
114113

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp