Almost-bug: missed case for builtin collation provider

From: Jeff Davis <pgsql(at)j-davis(dot)com>
To: pgsql-hackers(at)postgresql(dot)org
Subject: Almost-bug: missed case for builtin collation provider
Date: 2024-10-10 06:00:13
Message-ID: 1bd5a0a5192f82c22ee7527e825b18ab0028b2c7.camel@j-davis.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers


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

Attachment Content-Type Size
v17-0001-Fix-missed-case-for-builtin-collation-provider.patch text/x-patch 1.3 KB
v18-0001-Fix-missed-case-for-builtin-collation-provider.patch text/x-patch 1.4 KB

Browse pgsql-hackers by date

  From Date Subject
Next Message Kouber Saparev 2024-10-10 06:19:30 Re: BF mamba failure
Previous Message Shinya Kato 2024-10-10 05:56:29 Re: Set AUTOCOMMIT to on in script output by pg_dump