Re: Capitalization of localized month and day names (to_char() with 'TMmonth', 'TMday', etc.) - Mailing list pgsql-hackers

From Tom Lane
Subject Re: Capitalization of localized month and day names (to_char() with 'TMmonth', 'TMday', etc.)
Date
Msg-id 4139011.1633528909@sss.pgh.pa.us
Whole thread Raw
In response to Re: Capitalization of localized month and day names (to_char() with 'TMmonth', 'TMday', etc.)  (Juan José Santamaría Flecha <juanjo.santamaria@gmail.com>)
Responses Re: Capitalization of localized month and day names (to_char() with 'TMmonth', 'TMday', etc.)
List pgsql-hackers
=?UTF-8?Q?Juan_Jos=C3=A9_Santamar=C3=ADa_Flecha?= <juanjo.santamaria@gmail.com> writes:
> On Wed, Oct 6, 2021 at 11:09 AM Magnus Holmgren <magnus.holmgren@millnet.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



pgsql-hackers by date:

Previous
From: Jaime Casanova
Date:
Subject: Re: wrapping CF 2021-09
Next
From: Andrew Bille
Date:
Subject: Re: [Proposal] Global temporary tables