Re: to_char and i18n

From: Karel Zak <zakkr(at)zf(dot)jcu(dot)cz>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx>, pgsql-hackers(at)postgresql(dot)org
Subject: Re: to_char and i18n
Date: 2005-12-22 08:27:47
Message-ID: 1135240067.8425.30.camel@petra
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers pgsql-patches

On Wed, 2005-12-21 at 23:50 -0500, Tom Lane wrote:
> Manuel Sugawara <masm(at)fciencias(dot)unam(dot)mx> writes:
> > Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)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(at)zf(dot)jcu(dot)cz>

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Lukas Smith 2005-12-22 08:35:57 Re: Automatic function replanning
Previous Message Martin Pitt 2005-12-22 07:25:39 Re: horology regression test failure

Browse pgsql-patches by date

  From Date Subject
Next Message Alvaro Herrera 2005-12-22 13:03:49 Re: [BUGS] My investigations of the postmaster Bus error
Previous Message Manuel Sugawara 2005-12-22 05:50:06 Re: to_char and i18n