Fix missed case for builtin collation provider.
authorJeff Davis <[email protected]>
Fri, 11 Oct 2024 23:57:48 +0000 (16:57 -0700)
committerJeff Davis <[email protected]>
Fri, 11 Oct 2024 23:59:29 +0000 (16:59 -0700)
A missed check for the builtin collation provider could result in
falling through to call isalpha().

This does not appear to have practical consequences because it only
happens for characters in the ASCII range. Regardless, the builtin
provider should not be calling libc functions, so backpatch.

Discussion: https://postgr.es/m/1bd5a0a5192f82c22ee7527e825b18ab0028b2c7[email protected]
Backpatch-through: 17

src/backend/utils/adt/like_support.c

index 79c4ddc7573f235036d7a5bc5c8b81f7c471eae5..8b15509a3bf6950daf5933621a4ac1686b8ff3d1 100644 (file)
@@ -1500,13 +1500,11 @@ pattern_char_isalpha(char c, bool is_multibyte,
                return (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
        else if (is_multibyte && IS_HIGHBIT_SET(c))
                return true;
-       else if (locale->provider == COLLPROVIDER_ICU)
+       else if (locale->provider != COLLPROVIDER_LIBC)
                return IS_HIGHBIT_SET(c) ||
                        (c >= 'A' && c <= 'Z') || (c >= 'a' && c <= 'z');
-       else if (locale->provider == COLLPROVIDER_LIBC)
-               return isalpha_l((unsigned char) c, locale->info.lt);
        else
-               return isalpha((unsigned char) c);
+               return isalpha_l((unsigned char) c, locale->info.lt);
 }