Re: Capitalization of localized month and day names (to_char() with 'TMmonth', 'TMday', etc.)

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: Juan José Santamaría Flecha <juanjo(dot)santamaria(at)gmail(dot)com>
Cc: Magnus Holmgren <magnus(dot)holmgren(at)millnet(dot)se>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: Capitalization of localized month and day names (to_char() with 'TMmonth', 'TMday', etc.)
Date: 2021-10-06 14:01:49
Message-ID: 4139011.1633528909@sss.pgh.pa.us
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

=?UTF-8?Q?Juan_Jos=C3=A9_Santamar=C3=ADa_Flecha?= <juanjo(dot)santamaria(at)gmail(dot)com> writes:
> On Wed, Oct 6, 2021 at 11:09 AM Magnus Holmgren <magnus(dot)holmgren(at)millnet(dot)se>
> wrote:
>> There's just this tiny but seemingly obvious issue that I can't believe I
>> haven't noticed until now: to_date(now(), 'TMmonth') returns 'october' in
>> an
>> English locale (en_US.UTF-8 at least). Names of months and weekdays are
>> proper
>> nouns and as such *always* capitalized in English, so that seems wrong to
>> me.

> IMHO, the patterns of TO_CHAR() do as promised in the documentation [1]:
> MONTH full upper case month name (blank-padded to 9 chars)
> Month full capitalized month name (blank-padded to 9 chars)
> month full lower case month name (blank-padded to 9 chars)

> What you are proposing looks more like a new feature than a bug.

Yeah, this is operating as designed and documented. The idea that
there should be a way to get "month name as it'd be spelled mid-sentence"
is an interesting one, but I really doubt that anyone would thank us for
changing TMmonth to act that way. (Perhaps a new format code or modifier
would be easier to swallow?)

I also wonder exactly how the code would figure out what to do ---
language-specific conventions for this are not information available
from the libc locale APIs, AFAIR.

regards, tom lane

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Andrew Bille 2021-10-06 14:09:36 Re: [Proposal] Global temporary tables
Previous Message Jaime Casanova 2021-10-06 13:54:50 Re: wrapping CF 2021-09