Casefold wording in ILIKE comment

Started by Sivaprasad3 months ago1 messageshackers
Jump to latest
#1Sivaprasad
sivaprasad.postgres@gmail.com

Hi! While going through like_match.c [1]https://github.com/postgres/postgres/blob/master/src/backend/utils/adt/like_match.c#L73, I noticed this comment around line 73:

/*
* MATCH_LOWER is defined for ILIKE in the C locale as an optimization. Other
* locales must casefold the inputs before matching.
*/

The non-C-locale path (Generic_Text_IC_like() in like.c) actually
calls lower(), not a Unicode casefold(), so "casefold" here seems to
overstate what's happening, especially given the ongoing lower() vs
casefold() discussion for ILIKE [2]/messages/by-id/64d7949bad90545f981ac7513fb0b4954daca2c9.camel@j-davis.com. Would something like "downcase"
or "lowercase" be more accurate, to avoid implying the casefold
semantics already landed?

Source:
[1]: https://github.com/postgres/postgres/blob/master/src/backend/utils/adt/like_match.c#L73
[2]: /messages/by-id/64d7949bad90545f981ac7513fb0b4954daca2c9.camel@j-davis.com