Support for ISO 8601 in the jsonpath .datetime() method
authorAlexander Korotkov <akorotkov@postgresql.org>
Tue, 29 Sep 2020 08:41:46 +0000 (11:41 +0300)
committerAlexander Korotkov <akorotkov@postgresql.org>
Tue, 29 Sep 2020 09:00:04 +0000 (12:00 +0300)
commit927d9abb6538e441aa97bb3eea7a15d4cda70715
treec7b74b58d037059616a12947d3955ea76fac2d88
parentc2aa562ea5c2bf28c347503731434f08097cf1e5
Support for ISO 8601 in the jsonpath .datetime() method

The SQL standard doesn't require jsonpath .datetime() method to support the
ISO 8601 format.  But our to_json[b]() functions convert timestamps to text in
the ISO 8601 format in the sake of compatibility with javascript.  So, we add
support of the  ISO 8601 to the jsonpath .datetime() in the sake compatibility
with to_json[b]().

The standard mode of datetime parsing currently supports just template patterns
and separators in the format string.  In order to implement ISO 8601, we have to
add support of the format string double quotes to the standard parsing mode.

Discussion: https://postgr.es/m/94321be0-cc96-1a81-b6df-796f437f7c66%40postgrespro.ru
Author: Nikita Glukhov, revised by me
Backpatch-through: 13
src/backend/utils/adt/formatting.c
src/backend/utils/adt/jsonpath_exec.c
src/test/regress/expected/jsonb_jsonpath.out
src/test/regress/sql/jsonb_jsonpath.sql