mirror of
https://github.com/postgres/postgres.git
synced 2025-06-23 14:01:44 +03:00
ICU support
Add a column collprovider to pg_collation that determines which library provides the collation data. The existing choices are default and libc, and this adds an icu choice, which uses the ICU4C library. The pg_locale_t type is changed to a union that contains the provider-specific locale handles. Users of locale information are changed to look into that struct for the appropriate handle to use. Also add a collversion column that records the version of the collation when it is created, and check at run time whether it is still the same. This detects potentially incompatible library upgrades that can corrupt indexes and other structures. This is currently only supported by ICU-provided collations. initdb initializes the default collation set as before from the `locale -a` output but also adds all available ICU locales with a "-x-icu" appended. Currently, ICU-provided collations can only be explicitly named collations. The global database locales are still always libc-provided. ICU support is enabled by configure --with-icu. Reviewed-by: Thomas Munro <thomas.munro@enterprisedb.com> Reviewed-by: Andreas Karlsson <andreas@proxel.se>
This commit is contained in:
@ -5259,7 +5259,7 @@ find_join_input_rel(PlannerInfo *root, Relids relids)
|
||||
/*
|
||||
* Check whether char is a letter (and, hence, subject to case-folding)
|
||||
*
|
||||
* In multibyte character sets, we can't use isalpha, and it does not seem
|
||||
* In multibyte character sets or with ICU, we can't use isalpha, and it does not seem
|
||||
* worth trying to convert to wchar_t to use iswalpha. Instead, just assume
|
||||
* any multibyte char is potentially case-varying.
|
||||
*/
|
||||
@ -5271,9 +5271,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 && locale->provider == COLLPROVIDER_ICU)
|
||||
return IS_HIGHBIT_SET(c) ? true : false;
|
||||
#ifdef HAVE_LOCALE_T
|
||||
else if (locale)
|
||||
return isalpha_l((unsigned char) c, locale);
|
||||
else if (locale && locale->provider == COLLPROVIDER_LIBC)
|
||||
return isalpha_l((unsigned char) c, locale->info.lt);
|
||||
#endif
|
||||
else
|
||||
return isalpha((unsigned char) c);
|
||||
|
Reference in New Issue
Block a user