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

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>, Arthur Zakirov <zaartur(at)gmail(dot)com>, Tomas Vondra <tomas(dot)vondra(at)2ndquadrant(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Allow to_date() and to_timestamp() to accept localized names
Date: 2020-01-24 18:01:41
Message-ID: ba83b5a7-e63e-5aaf-ac29-745a549f9d7d@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 2020-01-24 18:25, Juan José Santamaría Flecha wrote:
> To illustrate the issue, it does not work as expected:
>
> postgres=# select lower(to_char(now(),'TMMONTH'));
>    lower
> ------------
>  ιανουάριοσ
> (1 row)
>
> postgres=# select to_char(now(),'TMmonth');
>   to_char
> ------------
>  ιανουάριος
> (1 row)

Well, this is interesting, because on macOS and Debian stable I get

postgres=# select to_char(now(),'TMmonth');
to_char
------------
ιανουαρίου
(1 row)

which is the genitive of ιανουάριος. You use the genitive form for a
date (24th of January) but the nominative otherwise. But the reverse
mapping can only take one of these forms. So here

select to_date('Ιανουαριος', 'TMMonth');

fails, which is bad.

In the glibc locale data sources they have both forms listed, but
apparently the API were are using only accepts one of them.

(I don't know any Greek, I'm just extrapolating from Wikipedia and
locale data.)

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Alvaro Herrera 2020-01-24 18:03:12 Re: making the backend's json parser work in frontend code
Previous Message Robert Haas 2020-01-24 17:56:53 Re: making the backend's json parser work in frontend code