Re: to_char and i18n - Mailing list pgsql-hackers

From Karel Zak
Subject Re: to_char and i18n
Date
Msg-id 1135240067.8425.30.camel@petra
Whole thread Raw
In response to Re: to_char and i18n  (Tom Lane <tgl@sss.pgh.pa.us>)
Responses Re: to_char and i18n
List pgsql-hackers
On Wed, 2005-12-21 at 23:50 -0500, Tom Lane wrote:
> Manuel Sugawara <masm@fciencias.unam.mx> writes:
> > Tom Lane <tgl@sss.pgh.pa.us> writes:
> >> I thought to_char already had i18n behavior.  What exactly are you
> >> thinking of changing?
> 
> > The modifiers that are suitable to localize. Month and day names comes
> > to mind and maybe others, I'm not sure what the state of the code is,
> > but I can say that, at least, the 'month' and 'day' modifiers does not
> > behave in a localized way.

The names for months and days are hardcoded to to_char code and it's in
English only.

> Can we spell the names differently but keep to the same field widths?

That's important point. How resolve this problem Oracle? Maybe we can
say (in docs) that with non-English locales it works with days/months
names as in FM (fill) mode.

# select length( to_char(now(), 'Day') ) as Normal,        length( to_char(now(), 'FMDay') ) as FM;normal | fm
--------+----     9 |  8

It means 'FM' uses variable size of Day/Month field -- without FM is the
size fixed to 9 chars.

I think that for backward compatibility the locale sensitive to_char()
should be implemented as separate call "to_char(datetime, format,
locale)" or we should add new modifiers to the current to_char,
something like "to_char(datetime, "LCMonth") or both.

I don't have any time to work on to_char(), I can help to review patches
only.
Karel

-- 
Karel Zak <zakkr@zf.jcu.cz>



pgsql-hackers by date:

Previous
From: Martijn van Oosterhout
Date:
Subject: Re: Re: Which qsort is used
Next
From: Lukas Smith
Date:
Subject: Re: Automatic function replanning