Re: TODO item:Allow to_date() and to_timestamp() accept localized month names

Поиск
Список
Период
Сортировка
От Bruce Momjian
Тема Re: TODO item:Allow to_date() and to_timestamp() accept localized month names
Дата
Msg-id 200802081556.m18FuiH24782@momjian.us
обсуждение исходный текст
Ответ на Re: TODO item:Allow to_date() and to_timestamp() accept localized month names  ("Gevik Babakhani" <pgdev@xs4all.nl>)
Ответы Re: TODO item:Allow to_date() and to_timestamp() accept localized month names  ("Gevik Babakhani" <pgdev@xs4all.nl>)
Список pgsql-hackers
Gevik Babakhani wrote:
> > 
> > Surely it should be the inverse of the solution for output, 
> > eg TMMon selects localized input.
> > 
> 
> After some investigation in how gettext works, I would like to have your
> opinion about how to 
> implement this TODO item.
> 
> Starting with TO_CHAR: 
> 
> When the TM prefix is used in TO_CHAR (for example TMMonth),
> the routine, internally calls functions like the localize_month and
> localize_day to get the localized value.
> These functions rely on the current locale category that is internally
> loaded by GetText "engine". 
> The GetText engine does not load any other locate category unless SET
> LC_MESSAGES or alike is given.
> 
> 
> Now back to TO_DATE: 
> 
> For this there are three solution that I can think of.
> 
> 1. For TO_DATE to return localized data we can implement the TM prefix logic
> which is already
> implemented in TO_CHAR. Copying and modifying it for TO_DATE should be
> feasible.
> The downside of this solution is that TO_DATE will only return localized
> values base on current locale. (no third parameter)

I can't remember anyone asking for more sophisticated solutions so it
seems implementing #1 at this point is the best approach.

--  Bruce Momjian  <bruce@momjian.us>        http://momjian.us EnterpriseDB
http://postgres.enterprisedb.com
 + If your life is a hard drive, Christ can be your backup. +


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

Предыдущее
От: Magnus Hagander
Дата:
Сообщение: Re: Patch review
Следующее
От: Tom Lane
Дата:
Сообщение: Re: The question of LOCALE at the time of a regression test.