@@ -100,7 +100,7 @@ static Selectivity regex_selectivity(const char *patt, int pattlen,
100100 bool case_insensitive ,
101101 int fixed_prefix_len );
102102static int pattern_char_isalpha (char c , bool is_multibyte ,
103- pg_locale_t locale , bool locale_is_c );
103+ pg_locale_t locale );
104104static Const * make_greater_string (const Const * str_const , FmgrInfo * ltproc ,
105105 Oid collation );
106106static Datum string_to_datum (const char * str , Oid datatype );
@@ -1000,7 +1000,6 @@ like_fixed_prefix(Const *patt_const, bool case_insensitive, Oid collation,
10001000 match_pos ;
10011001 bool is_multibyte = (pg_database_encoding_max_length () > 1 );
10021002 pg_locale_t locale = 0 ;
1003- bool locale_is_c = false;
10041003
10051004 /* the right-hand const is type text or bytea */
10061005 Assert (typeid == BYTEAOID || typeid == TEXTOID );
@@ -1024,11 +1023,7 @@ like_fixed_prefix(Const *patt_const, bool case_insensitive, Oid collation,
10241023 errhint ("Use the COLLATE clause to set the collation explicitly." )));
10251024 }
10261025
1027- /* If case-insensitive, we need locale info */
1028- if (lc_ctype_is_c (collation ))
1029- locale_is_c = true;
1030- else
1031- locale = pg_newlocale_from_collation (collation );
1026+ locale = pg_newlocale_from_collation (collation );
10321027 }
10331028
10341029 if (typeid != BYTEAOID )
@@ -1065,7 +1060,7 @@ like_fixed_prefix(Const *patt_const, bool case_insensitive, Oid collation,
10651060
10661061 /* Stop if case-varying character (it's sort of a wildcard) */
10671062 if (case_insensitive &&
1068- pattern_char_isalpha (patt [pos ], is_multibyte , locale , locale_is_c ))
1063+ pattern_char_isalpha (patt [pos ], is_multibyte , locale ))
10691064 break ;
10701065
10711066 match [match_pos ++ ] = patt [pos ];
@@ -1499,16 +1494,16 @@ regex_selectivity(const char *patt, int pattlen, bool case_insensitive,
14991494 */
15001495static int
15011496pattern_char_isalpha (char c , bool is_multibyte ,
1502- pg_locale_t locale , bool locale_is_c )
1497+ pg_locale_t locale )
15031498{
1504- if (locale_is_c )
1499+ if (locale -> ctype_is_c )
15051500 return (c >= 'A' && c <= 'Z' ) || (c >= 'a' && c <= 'z' );
15061501 else if (is_multibyte && IS_HIGHBIT_SET (c ))
15071502 return true;
1508- else if (locale && locale -> provider == COLLPROVIDER_ICU )
1503+ else if (locale -> provider == COLLPROVIDER_ICU )
15091504 return IS_HIGHBIT_SET (c ) ||
15101505 (c >= 'A' && c <= 'Z' ) || (c >= 'a' && c <= 'z' );
1511- else if (locale && locale -> provider == COLLPROVIDER_LIBC )
1506+ else if (locale -> provider == COLLPROVIDER_LIBC )
15121507 return isalpha_l ((unsigned char ) c , locale -> info .lt );
15131508 else
15141509 return isalpha ((unsigned char ) c );
0 commit comments