17: lc_collate_is_c() when LC_CTYPE != LC_COLLATE
Jeff Davis <pgsql@j-davis.com>
From: Jeff Davis <pgsql@j-davis.com>
To: pgsql-bugs@postgresql.org
Date: 2024-11-06T17:35:27Z
Lists: pgsql-bugs
Attachments
- v1-0001-Fix-lc_collate_is_c-when-LC_COLLATE-LC_CTYPE.patch (text/x-patch) patch v1-0001
Due to a very unfortunate copy-and-paste error in 2d819a08a1, for the libc provider, lc_collate_is_c() is checking the environment's LC_CTYPE rather than LC_COLLATE :( This sort of works if LC_COLLATE=C and LC_CTYPE=en_US.utf8 (or another real locale), because lc_collate_is_c() returns false and it falls through to strcoll(), which will observe LC_COLLATE. But if LC_COLLATE=en_US.utf8 and LC_CTYPE=C, then it's wrong results. By good fortune, I believe that the latter combination is fairly rare, which may explain why it evaded manual testing until now. But it's still pretty bad. Trivial patch attached, which I intend to commit shortly to 17 only. The bug does not exist in master due to recent refactoring. Regards, Jeff Davis
Commits
-
Fix lc_collate_is_c() when LC_COLLATE != LC_CTYPE.
- 8148e7124d55 17.1 landed