mirror of
https://github.com/postgres/postgres.git
synced 2026-10-29 15:58:33 +03:00
Fix pg_iswcased() for some libc case mappings.
Some C libraries, such as macOS libc, case-map characters that they do not classify as upper or lower. ILIKE index scans could then miss rows, because those characters stayed in the fixed prefix. Introduced in630706ced0.43a948b7b2fixed similar issues, but missed this one. Author: shihao zhong <zhong950419@gmail.com> Reviewed-by: Fujii Masao <masao.fujii@gmail.com> Reviewed-by: Chao Li <li.evan.chao@gmail.com> Discussion: https://postgr.es/m/CAGRkXqS6pr-hG-g=K6RTdRw53SnMZWz3iXvh_wi8rqLSf972sA@mail.gmail.com Backpatch-through: 19
This commit is contained in:
@@ -328,10 +328,14 @@ wc_iscased_libc_utf8(pg_wchar wc, pg_locale_t locale)
|
||||
|
||||
/*
|
||||
* For UTF8, pg_wchar is a codepoint and we assume we can pass it directly
|
||||
* to iswupper_l()/iswlower_l().
|
||||
* to iswupper_l()/iswlower_l(). Some C libraries case-map characters
|
||||
* that they do not classify as upper or lower, so also check the mapping,
|
||||
* which is what ILIKE uses.
|
||||
*/
|
||||
return iswupper_l((wint_t) wc, locale->lt) ||
|
||||
iswlower_l((wint_t) wc, locale->lt);
|
||||
iswlower_l((wint_t) wc, locale->lt) ||
|
||||
towupper_l((wint_t) wc, locale->lt) != (wint_t) wc ||
|
||||
towlower_l((wint_t) wc, locale->lt) != (wint_t) wc;
|
||||
}
|
||||
|
||||
static pg_wchar
|
||||
|
||||
Reference in New Issue
Block a user