Almost-bug: missed case for builtin collation provider

Started by Jeff Davisabout 2 years ago1 messageshackers
Jump to latest
#1Jeff Davis
pgsql@j-davis.com

pattern_char_isalpha() doesn't check for the PG_C_UTF8 builtin
collation provider, and ends up falling through to isalpha() for
characters in the ascii range.

I don't think this is an actual correctness bug, because:

(a) For all locales I tested on linux and mac, isalpha() has
identical behavior for the ascii range.
(b) To be an actual correctness bug, it would need to be a false
negative; that is, to say that a character is not case-varying when it
is. The only case-varying characters in the ascii range for PG_C_UTF8
are [A-Za-z], and it seems unlikely that any locale would treat those
as non-alphabetic.

But I I think we should fix and backport to 17, because there's no
reason we should be calling libc at all when using PG_C_UTF8, and it
might cause an issue on some platform that I didn't test.

Fix attached (slightly different on master and 17). I intend to commit
soon.

Regards,
Jeff Davis

Attachments:

v17-0001-Fix-missed-case-for-builtin-collation-provider.patchtext/x-patch; charset=UTF-8; name=v17-0001-Fix-missed-case-for-builtin-collation-provider.patchDownload+1-2
v18-0001-Fix-missed-case-for-builtin-collation-provider.patchtext/x-patch; charset=UTF-8; name=v18-0001-Fix-missed-case-for-builtin-collation-provider.patchDownload+2-5