Re: Allow to_date() and to_timestamp() to accept localized names

Поиск
Список
Период
Сортировка
От Juan José Santamaría Flecha
Тема Re: Allow to_date() and to_timestamp() to accept localized names
Дата
Msg-id CAC+AXB1ao4uniAXNnWU3uyq6Ks=nyKq5MwzrFM8sw_MLUF+E=Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Allow to_date() and to_timestamp() to accept localized names  (Alvaro Herrera <alvherre@2ndquadrant.com>)
Ответы Re: Allow to_date() and to_timestamp() to accept localized names  (Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>)
Список pgsql-hackers
On Fri, Sep 13, 2019 at 10:31 PM Alvaro Herrera
<alvherre@2ndquadrant.com> wrote:
>
Thanks for taking a look at this.

> I'm confused why we acquire the MONTH_DIM / etc definitions.  Can't we
> just use lengthof() of the corresponding array?  AFAICS it should work
> just as well.
>

It was because of the length difference between ascii-name arrays,
which were all null-ended, and localized-name arrays. The attached
version uses lengthof().

> I wonder if the "compare first char" thing (seq_search_localized) really
> works when there are multibyte chars in the day/month names.  I think
> the code compares just the first char ... but what if the original
> string uses those funny Unicode non-normalized letters and the locale
> translation uses normalized letters?  My guess is that the first-char
> comparison will fail, but surely you'll want the name to match.
> (There's no month/day name in Spanish that doesn't start with an ASCII
> letter, but I bet there are some in other languages.)  I think the
> localized comparison should avoid the first-char optimization, just
> compare the whole string all the time, and avoid possible weird issues.

The localized search is reformulated in this version to deal with
multibyte normalization. A regression test for this issue is included.


Regards,

Juan José Santamaría Flecha

Вложения

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

Предыдущее
От: Quan Zongliang
Дата:
Сообщение: Add a GUC variable that control logical replication
Следующее
От: Peter Eisentraut
Дата:
Сообщение: Re: Add a GUC variable that control logical replication