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

From: "Gevik Babakhani" <pgdev(at)xs4all(dot)nl>
To: "'Tom Lane'" <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: <pgsql-hackers(at)postgresql(dot)org>, "'Alvaro Herrera'" <alvherre(at)commandprompt(dot)com>, "'Peter Eisentraut'" <peter_e(at)gmx(dot)net>
Subject: Re: TODO item:Allow to_date() and to_timestamp() accept localized month names
Date: 2008-02-05 08:25:13
Message-ID: 003501c867d0$a281e760$0a01a8c0@gevmus
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

(I really should stop reading the code after 12:00AM)

So if I understand correctly, the proper solution would be to handle the
localized (TM) format
within to_date (seq_search). This means that prior calling to_date a SET
LC_MESSAGES must be given.
but if we are following Oracle,
(http://www.techonthenet.com/oracle/functions/to_date.php) a third parameter
to enforce the nls_language is required. Please advice.

Regards,
Gevik.

> -----Original Message-----
> From: Tom Lane [mailto:tgl(at)sss(dot)pgh(dot)pa(dot)us]
> Sent: Tuesday, February 05, 2008 2:29 AM
> To: Gevik Babakhani
> Cc: pgsql-hackers(at)postgresql(dot)org
> Subject: Re: [HACKERS] TODO item:Allow to_date() and
> to_timestamp() accept localized month names
>
> "Gevik Babakhani" <pgdev(at)xs4all(dot)nl> writes:
> >> Surely it should be the inverse of the solution for
> output, eg TMMon
> >> selects localized input.
>
> > Of cource. But how would TM enforce a localized formatting.
> (perhaps I
> > am off.... 2:10 am...) Lets say I have en_US database but
> the dates I
> > am trying to format is nl_NL.
> > If I am not mistaking SET LC_MESSAGES won't help.
>
> Works for me:
>
> postgres=# show lc_messages ;
> lc_messages
> -------------
> de_DE.utf8
> (1 row)
>
> postgres=# select to_char(now(), 'TMDay, DD TMMonth YYYY');
> to_char
> -------------------------
> Montag, 04 Februar 2008
> (1 row)
>
> postgres=# set lc_messages TO 'es_ES.utf8'; SET postgres=#
> select to_char(now(), 'TMDay, DD TMMonth YYYY');
> to_char
> ------------------------
> Lunes, 04 Febrero 2008
> (1 row)
>
>
> regards, tom lane
>

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Magnus Hagander 2008-02-05 09:00:29 Re: Re: [COMMITTERS] pgsql: configure tag'd 8.3.0 and built witih autoconf 2.59
Previous Message Peter Eisentraut 2008-02-05 08:04:04 Re: TODO item:Allow to_date() and to_timestamp() accept localized month names