From: | Bruce Momjian <bruce(at)momjian(dot)us> |
---|---|
To: | Gevik Babakhani <pgdev(at)xs4all(dot)nl> |
Cc: | "'Peter Eisentraut'" <peter_e(at)gmx(dot)net>, pgsql-hackers(at)postgresql(dot)org, "'Alvaro Herrera'" <alvherre(at)commandprompt(dot)com>, "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us> |
Subject: | Re: TODO item:Allow to_date() and to_timestamp() accept localized month names |
Date: | 2008-02-08 15:56:44 |
Message-ID: | 200802081556.m18FuiH24782@momjian.us |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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(at)momjian(dot)us> http://momjian.us
EnterpriseDB http://postgres.enterprisedb.com
+ If your life is a hard drive, Christ can be your backup. +
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2008-02-08 16:10:02 | Re: The question of LOCALE at the time of a regression test. |
Previous Message | Magnus Hagander | 2008-02-08 15:46:33 | Re: Patch review |