Обсуждение: BUG #16286: Некорректно работает функция lower

Поиск
Список
Период
Сортировка

BUG #16286: Некорректно работает функция lower

От
PG Bug reporting form
Дата:
The following bug has been logged on the website:

Bug reference:      16286
Logged by:          Макс Лютов
Email address:      lyutovmax@gmail.com
PostgreSQL version: 12.2
Operating system:   Ubuntu 18.04.4 LTS
Description:

Запрос select lower(convert_from(convert_to('ТеСт', 'UTF8'), 'UTF8'))
возвращает 'ТеСт' , а не 'тест'


Re: BUG #16286: Некорректно работает функция lower

От
Tom Lane
Дата:
PG Bug reporting form <noreply@postgresql.org> writes:
> Запрос select lower(convert_from(convert_to('ТеСт', 'UTF8'), 'UTF8'))
> возвращает 'ТеСт' , а не 'тест'

I don't speak Russian, but try it like this:

ru=# select lower(convert_from(convert_to('ТеСт', 'UTF8'), 'UTF8' collate "default"));
 lower
-------
 тест
(1 row)

Without that, the collation of the expression works out as "C" because
convert_from's second argument is of type "name", which since v12
has default collation "C".  Then lower() won't do anything with
non-ASCII letters.

            regards, tom lane