pg.ddx.io  pgsql-committers@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Tom Lane <tgl@sss.pgh.pa.us>
To: pgsql-committers@lists.postgresql.org
Subject: pgsql: Allow to_date/to_timestamp to recognize non-English month/day na
Date: Tue, 03 Mar 2020 16:06:54 +0000
Message-ID: <E1j9A4M-00011U-22@gemulon.postgresql.org> (raw)

Allow to_date/to_timestamp to recognize non-English month/day names.

to_char() has long allowed the TM (translation mode) prefix to
specify output of translated month or day names; but that prefix
had no effect in input format strings.  Now it does.  to_date()
and to_timestamp() will now recognize the same month or day names
that to_char() would output for the same format code.  Matching is
case-insensitive (per the active collation's notion of what that
means), just as it has always been for English month/day names
without the TM prefix.

(As per the discussion thread, there are lots of cases that this
feature will not handle, such as alternate day names.  But being
able to accept what to_char() will output seems useful enough.)

In passing, fix some shaky English and violations of message
style guidelines in jsonpath errors for the .datetime() method,
which depends on this code.

Juan José Santamaría Flecha, reviewed and modified by me,
with other commentary from Alvaro Herrera, Tomas Vondra,
Arthur Zakirov, Peter Eisentraut, Mark Dilger.

Discussion: https://postgr.es/m/CAC+AXB3u1jTngJcoC1nAHBf=M3v-jrEfo86UFtCqCjzbWS9QhA@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/d67755049388526cd8673aa826dc794b97345eb3

Modified Files
--------------
doc/src/sgml/func.sgml                           |  31 ++--
src/backend/utils/adt/formatting.c               | 175 +++++++++++++++++++----
src/backend/utils/adt/jsonpath_exec.c            |  17 ++-
src/backend/utils/adt/pg_locale.c                |  20 ++-
src/include/utils/formatting.h                   |   2 +-
src/test/regress/expected/collate.linux.utf8.out |  16 +++
src/test/regress/expected/jsonb_jsonpath.out     |   6 +-
src/test/regress/sql/collate.linux.utf8.sql      |   6 +
src/test/regress/sql/jsonb_jsonpath.sql          |   2 +-
9 files changed, 221 insertions(+), 54 deletions(-)



Message-ID: <E1j9A4M-00011U-22@gemulon.postgresql.org>
Permalink:  ../E1j9A4M-00011U-22@gemulon.postgresql.org/
Also on:    postgresql.org/message-id/E1j9A4M-00011U-22@gemulon.postgresql.org

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients from your mail client; the link fills in
  the headers below: reply via email
  Some clients, webmail especially, drop In-Reply-To and References from
  a link, and the reply then starts a new thread: use the mbox below.

  To: pgsql-committers@postgresql.org
  Cc: tgl@sss.pgh.pa.us
  Subject: Re: pgsql: Allow to_date/to_timestamp to recognize non-English month/day na
  In-Reply-To: <E1j9A4M-00011U-22@gemulon.postgresql.org>
  References: <E1j9A4M-00011U-22@gemulon.postgresql.org>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox