@@ -1221,7 +1221,7 @@ text_position_setup(text *t1, text *t2, Oid collid, TextPositionState *state)
1221
1221
if (!lc_collate_is_c (collid ))
1222
1222
mylocale = pg_newlocale_from_collation (collid );
1223
1223
1224
- if (mylocale && ! mylocale -> deterministic )
1224
+ if (! pg_locale_deterministic ( mylocale ) )
1225
1225
ereport (ERROR ,
1226
1226
(errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
1227
1227
errmsg ("nondeterministic collations are not supported for substring searches" )));
@@ -1572,8 +1572,7 @@ varstr_cmp(const char *arg1, int len1, const char *arg2, int len2, Oid collid)
1572
1572
result = pg_strncoll (arg1 , len1 , arg2 , len2 , mylocale );
1573
1573
1574
1574
/* Break tie if necessary. */
1575
- if (result == 0 &&
1576
- (!mylocale || mylocale -> deterministic ))
1575
+ if (result == 0 && pg_locale_deterministic (mylocale ))
1577
1576
{
1578
1577
result = memcmp (arg1 , arg2 , Min (len1 , len2 ));
1579
1578
if ((result == 0 ) && (len1 != len2 ))
@@ -1628,7 +1627,7 @@ texteq(PG_FUNCTION_ARGS)
1628
1627
else
1629
1628
mylocale = pg_newlocale_from_collation (collid );
1630
1629
1631
- if (locale_is_c || ! mylocale || mylocale -> deterministic )
1630
+ if (locale_is_c || pg_locale_deterministic ( mylocale ) )
1632
1631
{
1633
1632
Datum arg1 = PG_GETARG_DATUM (0 );
1634
1633
Datum arg2 = PG_GETARG_DATUM (1 );
@@ -1687,7 +1686,7 @@ textne(PG_FUNCTION_ARGS)
1687
1686
else
1688
1687
mylocale = pg_newlocale_from_collation (collid );
1689
1688
1690
- if (locale_is_c || ! mylocale || mylocale -> deterministic )
1689
+ if (locale_is_c || pg_locale_deterministic ( mylocale ) )
1691
1690
{
1692
1691
Datum arg1 = PG_GETARG_DATUM (0 );
1693
1692
Datum arg2 = PG_GETARG_DATUM (1 );
@@ -1801,7 +1800,7 @@ text_starts_with(PG_FUNCTION_ARGS)
1801
1800
if (!lc_collate_is_c (collid ))
1802
1801
mylocale = pg_newlocale_from_collation (collid );
1803
1802
1804
- if (mylocale && ! mylocale -> deterministic )
1803
+ if (! pg_locale_deterministic ( mylocale ) )
1805
1804
ereport (ERROR ,
1806
1805
(errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
1807
1806
errmsg ("nondeterministic collations are not supported for substring searches" )));
@@ -2217,8 +2216,7 @@ varstrfastcmp_locale(char *a1p, int len1, char *a2p, int len2, SortSupport ssup)
2217
2216
result = pg_strcoll (sss -> buf1 , sss -> buf2 , sss -> locale );
2218
2217
2219
2218
/* Break tie if necessary. */
2220
- if (result == 0 &&
2221
- (!sss -> locale || sss -> locale -> deterministic ))
2219
+ if (result == 0 && pg_locale_deterministic (sss -> locale ))
2222
2220
result = strcmp (sss -> buf1 , sss -> buf2 );
2223
2221
2224
2222
/* Cache result, perhaps saving an expensive strcoll() call next time */
0 commit comments