From: | Magnus Holmgren <magnus(dot)holmgren(at)millnet(dot)se> |
---|---|
To: | pgsql-hackers(at)lists(dot)postgresql(dot)org |
Subject: | Capitalization of localized month and day names (to_char() with 'TMmonth', 'TMday', etc.) |
Date: | 2021-10-06 09:08:57 |
Message-ID: | 14717914.JAiOoc7IO7@utklippan |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
Hello and thank you very much for the best open source database engine!
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.
If you want to build an internationalized application, you want 'TMmonth' to
return a month name that can be used in the middle of a sentence, capitalized
or not depending on locale, and 'TMMonth' to return an always capitalized
month name that can be used at the start of a sentence.
This was discussed back in 2008:
https://www.postgresql.org/message-id/flat/
47C34A98.7050102%40timbira.com#9593d90487976d28e2b612cff576545d
There is talk about how PostgreSQL has to do what Oracle does, but does it
really have to replicate bugs at this level of detail? Localized date and
number formats are only for presentation, and not meant to be machine-
readable.
I imagine that the reason it works the way it does is that the unlocalized
formats exist, and there wouldn't be any difference between 'month' and
'Month' if 'month' also capitalized month names due to English language rules,
and as long as you're not building an internationalized application you can
always use 'Month' to get it right.
(This is the situation in PostgreSQL 13, at least. I haven't tried PostgreSQL
14, but there are no mentions of to_char() or localization in the release
notes, nothing in the documentation of to_char() suggesting any change, and I
also haven't found any more recent discussions.)
Thoughts?
--
Magnus Holmgren
MILLNET AB, Teknikringen 6, 583 30 Linköping
--
Vid e-postkontakt med Millnet är det normalt att åtminstone vissa
personuppgifter sparas om dig. Du kan läsa mer om vilka uppgifter som
sparas och hur vi hanterar dem på https://www.millnet.se/integritetspolicy/
<https://www.millnet.se/integritetspolicy/>.
From | Date | Subject | |
---|---|---|---|
Next Message | Bharath Rupireddy | 2021-10-06 09:36:56 | Re: postgres_fdw: Obsolete comments in GetConnection() |
Previous Message | Etsuro Fujita | 2021-10-06 09:06:13 | postgres_fdw: Obsolete comments in GetConnection() |