pgsql: Allow to_date/to_timestamp to recognize non-English month/day na - Mailing list pgsql-committers

From Tom Lane
Subject pgsql: Allow to_date/to_timestamp to recognize non-English month/day na
Date
Msg-id E1j9A4M-00011U-22@gemulon.postgresql.org
Whole thread Raw
List pgsql-committers
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(-)


pgsql-committers by date:

Previous
From: Peter Eisentraut
Date:
Subject: pgsql: pg_standby: Don't use HAVE_WORKING_LINK
Next
From: Peter Eisentraut
Date:
Subject: pgsql: Move pg_upgrade's Windows link() implementation to AC_REPLACE_FU