Re: [HACKERS] adding an immutable variant of to_date - Mailing list pgsql-hackers

From Andreas Karlsson
Subject Re: [HACKERS] adding an immutable variant of to_date
Date
Msg-id 834dcca9-f144-6354-2ee9-3ed30da66451@proxel.se
Whole thread Raw
In response to Re: [HACKERS] adding an immutable variant of to_date  ("Sven R. Kunze" <srkunze@mail.de>)
Responses Re: [HACKERS] adding an immutable variant of to_date  ("Sven R. Kunze" <srkunze@mail.de>)
List pgsql-hackers
On 03/07/2017 09:56 PM, Sven R. Kunze wrote:
> On 07.03.2017 03:21, Andreas Karlsson wrote:
>> 1) I do not think we currently allow setting the locale like this
>> anywhere, so this will introduce a new concept to PostgreSQL. And you
>> will probably need to add support for caching per locale.
>
> Good to know. Could you explain what you mean by "caching per locale"?

The current code for to_char will on the first call to to_char build 
arrays with the localized names of the week days and the months. I 
suspect that you may need to build something similar but a set of arrays 
per locale.

See the DCH_to_char function and its call to cache_locale_time.

Andreas



pgsql-hackers by date:

Previous
From: Alvaro Herrera
Date:
Subject: Re: [HACKERS] new gcc 7.0.1 warnings
Next
From: Mark Dilger
Date:
Subject: Re: [HACKERS] Hash support for grouping sets