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

From: James Coleman <jtc331(at)gmail(dot)com>
To: Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>
Cc: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>, Mark Dilger <mark(dot)dilger(at)enterprisedb(dot)com>, 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-03-08 16:11:42
Message-ID: CAAaqYe-PJwDBw1HQApn3SR9SkorBvPGE5Wq9hA05BamtF8MX5Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Sun, Mar 8, 2020 at 10:42 AM James Coleman <jtc331(at)gmail(dot)com> wrote:

> On Sun, Mar 8, 2020 at 7:17 AM Juan José Santamaría Flecha <
> juanjo(dot)santamaria(at)gmail(dot)com> wrote:
>
>>
>>
>> On Sun, Mar 8, 2020 at 3:48 AM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>
>>> James Coleman <jtc331(at)gmail(dot)com> writes:
>>> > On Sat, Mar 7, 2020 at 9:31 PM Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> wrote:
>>> >> Looks like you may not have Turkish locale installed? Try
>>> >> locale -a | grep tr_TR
>>>
>>> > Hmm, when I grep the locales I see `tr_TR.utf8` in the output. I
>>> assume the
>>> > utf8 version is acceptable? Or is there a non-utf8 variant?
>>>
>>> Hmm ... I'm far from an expert on the packaging of locale data, but
>>> the simplest explanation I can think of is that the tr_TR locale exists
>>> to some extent on your machine but the LC_TIME component of that is
>>> missing.
>>>
>>
>> AFAICS, the locale 'tr_TR' uses the encoding ISO-8859-9 (LATIN5), is not
>> the same as 'tr_TR.utf8'.
>>
>
> The test name implies it's about utf8, though, which makes me wonder if
> the test should be testing utf8 instead?
>
> That being said, a bit more googling based on your node about the proper
> ISO encoding turned up this page: https://unix.stackexchange.com/a/446762
>
> And I confirmed that the locale you mentioned is available:
> $ grep "tr_TR" /usr/share/i18n/SUPPORTED
> tr_TR.UTF-8 UTF-8
> tr_TR ISO-8859-9
>
> So I tried:
> echo tr_TR.ISO-8859-9 >> /var/lib/locales/supported.d/local # In a root
> session
> sudo dpkg-reconfigure locales
>
> That didn't seem to fix it, though `locale -a` still only lists
> tr_TR.utf8, so I'm still at a loss, and also unclear why a test names utf8
> is actually relying on an ISO encoding.
>

Another update:

Since sudo dpkg-reconfigure locales opens up an ncurses gui on my machine,
I tried selecting the tr_TR.ISO-8859-9 option there and removed the
/var/lib/locales/supported.d/local file. Now I get:

$ locale -a | grep tr_TR
tr_TR
tr_TR.iso88599
tr_TR.utf8

And now `make check` passes.

I'm still interested in understanding why we're using the ISO locale
instead of the utf8 one in a utf8-labeled test though.

Thanks,
James

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2020-03-08 16:38:59 Re: Allow to_date() and to_timestamp() to accept localized names
Previous Message James Coleman 2020-03-08 15:54:56 Re: Fastpath while arranging the changes in LSN order in logical decoding