Almost-bug: missed case for builtin collation provider

Jeff Davis <pgsql@j-davis.com>

From: Jeff Davis <pgsql@j-davis.com>
To: pgsql-hackers@postgresql.org
Date: 2024-10-10T06:00:13Z
Lists: pgsql-hackers

Attachments

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

Commits

  1. Fix missed case for builtin collation provider.