Hi, This is the first low item from my list in [1]. It has the same cause as the EUC_* report in [2], and 43a948b7b25 did not fix it.
wc_iscased_libc_utf8() asks iswupper() and iswlower(), but ILIKE compares with towlower(). The macOS C library case-maps 117 code points that are neither upper nor lower, like U+2160 (Roman numeral one). So U+2160 stays in the index prefix: create table t (x text collate "en_US.UTF-8"); insert into t values (U&'\2160q'), (U&'\2170q'); insert into t select 'filler' || g from generate_series(1, 2000) g; create index on t (x text_pattern_ops); analyze t; select count(*) from t where x ilike U&'\2160q%'; On the master and REL_19_STABLE heads the index scan returns 1. A seq scan returns 2. glibc on Linux classifies all of them, so it is fine. The attached patch also counts a character as cased when towupper() or towlower() changes it. [1] https://postgr.es/m/cagrkxqsfdjqzp_kwrz7dv6lhx-csrkdnynnxgntrscenqtk...@mail.gmail.com [2] https://postgr.es/m/[email protected] Thanks, Shihao
v1-0001-Fix-pg_iswcased-for-libc-UTF8-case-mappings.patch
Description: Binary data
