pgsql: Implement jsonpath .datetime() method
От | Alexander Korotkov |
---|---|
Тема | pgsql: Implement jsonpath .datetime() method |
Дата | |
Msg-id | E1iDDKf-0008VX-RT@gemulon.postgresql.org обсуждение исходный текст |
Ответы |
Re: pgsql: Implement jsonpath .datetime() method
|
Список | pgsql-committers |
Implement jsonpath .datetime() method This commit implements jsonpath .datetime() method as it's specified in SQL/JSON standard. There are no-argument and single-argument versions of this method. No-argument version selects first of ISO datetime formats matching input string. Single-argument version accepts template string as its argument. Additionally to .datetime() method itself this commit also implements comparison ability of resulting date and time values. There is some difficulty because exising jsonb_path_*() functions are immutable, while comparison of timezoned and non-timezoned types involves current timezone. At first, current timezone could be changes in session. Moreover, timezones themselves are not immutable and could be updated. This is why we let existing immutable functions throw errors on such non-immutable comparison. In the same time this commit provides jsonb_path_*_tz() functions which are stable and support operations involving timezones. As new functions are added to the system catalog, catversion is bumped. Support of .datetime() method was the only blocker prevents T832 from being marked as supported. sql_features.txt is updated correspondingly. Extracted from original patch by Nikita Glukhov, Teodor Sigaev, Oleg Bartunov. Heavily revised by me. Comments were adjusted by Liudmila Mantrova. Discussion: https://postgr.es/m/fcc6fc6a-b497-f39a-923d-aa34d0c588e8%402ndQuadrant.com Discussion: https://postgr.es/m/CAPpHfdsZgYEra_PeCLGNoXOWYx6iU-S3wF8aX0ObQUcZU%2B4XTw%40mail.gmail.com Author: Alexander Korotkov, Nikita Glukhov, Teodor Sigaev, Oleg Bartunov, Liudmila Mantrova Reviewed-by: Anastasia Lubennikova, Peter Eisentraut Branch ------ master Details ------- https://git.postgresql.org/pg/commitdiff/bffe1bd68457e43925c362d8728ce3b25bdf1c94 Modified Files -------------- doc/src/sgml/func.sgml | 117 +++++- src/backend/catalog/sql_features.txt | 2 +- src/backend/catalog/system_views.sql | 40 +++ src/backend/utils/adt/jsonpath.c | 24 +- src/backend/utils/adt/jsonpath_exec.c | 470 ++++++++++++++++++++++-- src/backend/utils/adt/jsonpath_gram.y | 14 + src/backend/utils/adt/jsonpath_scan.l | 1 + src/backend/utils/errcodes.txt | 1 + src/include/catalog/catversion.h | 2 +- src/include/catalog/pg_proc.dat | 22 ++ src/include/utils/jsonpath.h | 1 + src/test/regress/expected/jsonb_jsonpath.out | 520 +++++++++++++++++++++++++++ src/test/regress/expected/jsonpath.out | 12 + src/test/regress/sql/jsonb_jsonpath.sql | 172 +++++++++ src/test/regress/sql/jsonpath.sql | 2 + 15 files changed, 1355 insertions(+), 45 deletions(-)
В списке pgsql-committers по дате отправления: