Re: case insensitive collation of Greek's sigma

Поиск
Список
Период
Сортировка
От Tom Lane
Тема Re: case insensitive collation of Greek's sigma
Дата
Msg-id 1989905.1638388164@sss.pgh.pa.us
обсуждение исходный текст
Ответ на Re: case insensitive collation of Greek's sigma  (Peter Eisentraut <peter.eisentraut@enterprisedb.com>)
Ответы Re: case insensitive collation of Greek's sigma
Список pgsql-general
Peter Eisentraut <peter.eisentraut@enterprisedb.com> writes:
> Running lower() like this is really the wrong thing to do.  We should be 
> doing "case folding" instead, which normalizes these differences for the 
> purpose of case-insensitive comparisons.

That just begs the question: if tolower (or towlower) isn't the
appropriate API, what is?  Perhaps ICU has something for a more
generalized notion of case-similarity, but I'm not aware of any such
thing in the POSIX API.

BTW, I think it's only accidental that the regex example shown upthread
gets the right answer.  In that example, what's happening is that we
consider a letter in a case-insensitive regex to match itself, or
tolower() of itself, or toupper() of itself.  Both σ and ς have Σ
as toupper() so they both work.  But if you'd written Σ in the regex,
only one of σ and ς would match that as a data character.  (Haven't
actually tested this, but given the way the code works I'm pretty
sure it's so.)  Again, it's hard to see how to do better atop a POSIX
locale library.

            regards, tom lane



В списке pgsql-general по дате отправления:

Предыдущее
От: "Jenda Krynicky"
Дата:
Сообщение: Re: INSERT ... ON CONFLICT doesn't work
Следующее
От: Tom Lane
Дата:
Сообщение: Re: INSERT ... ON CONFLICT doesn't work