pgsql: Allow datetime values in JsonbValue

From: Alexander Korotkov <akorotkov(at)postgresql(dot)org>
To: pgsql-committers(at)lists(dot)postgresql(dot)org
Subject: pgsql: Allow datetime values in JsonbValue
Date: 2019-09-25 19:52:13
Message-ID: E1iDDKf-0008VV-Qf@gemulon.postgresql.org
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Allow datetime values in JsonbValue

SQL/JSON standard allows manipulation with datetime values. So, it appears to
be convinient to allow datetime values to be represented in JsonbValue struct.
These datetime values are allowed for temporary representation only. During
serialization datetime values are converted into strings.

SQL/JSON requires writing timestamps with timezone in the same timezone offset
as they were parsed. This is why we allow storage of timezone offset in
JsonbValue struct. For the same reason timezone offset argument is added to
JsonEncodeDateTime() function.

Extracted from original patch by Nikita Glukhov, Teodor Sigaev, Oleg Bartunov.
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: Nikita Glukhov, Teodor Sigaev, Oleg Bartunov, Alexander Korotkov, Liudmila Mantrova
Reviewed-by: Anastasia Lubennikova, Peter Eisentraut

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/6dda292d4df82a9158d1acc93feecf3b84637b59

Modified Files
--------------
src/backend/utils/adt/json.c | 32 ++++++++++++++++++++++++++------
src/backend/utils/adt/jsonb.c | 27 ++++++++++++++++++++++++---
src/backend/utils/adt/jsonb_util.c | 21 +++++++++++++++++++++
src/include/utils/jsonapi.h | 3 ++-
src/include/utils/jsonb.h | 24 +++++++++++++++++++++---
5 files changed, 94 insertions(+), 13 deletions(-)

Browse pgsql-committers by date

  From Date Subject
Next Message Alexander Korotkov 2019-09-25 21:05:58 Re: pgsql: Implement jsonpath .datetime() method
Previous Message Alvaro Herrera 2019-09-25 19:20:57 pgsql: Update expected output for dummy_index_am