Re: Support for jsonpath .datetime() method

From: Peter Eisentraut <peter(dot)eisentraut(at)2ndquadrant(dot)com>
To: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>, Liudmila Mantrova <l(dot)mantrova(at)postgrespro(dot)ru>
Cc: Anastasia Lubennikova <lubennikovaav(at)gmail(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>, Nikita Glukhov <n(dot)gluhov(at)postgrespro(dot)ru>
Subject: Re: Support for jsonpath .datetime() method
Date: 2019-07-23 13:44:07
Message-ID: a9084f8c-7ff8-bad6-f1cc-1672446b7a75@2ndquadrant.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

I think the best way forward here is to focus first on patch 0002 and
get the additional format templates in, independent of any surrounding
JSON functionality.

In particular, remove parse_datetime() and all the related API changes,
then it becomes much simpler.

The codes FF1..FF6 that you added appear to be correct, but reading the
spec I find there is more missing, specifically

- RRRR and RR
- SSSSS (currently only SSSS is supported, but that's not standard)

Also in some cases we allow timestamps with seven digits of fractional
precision, so perhaps FF7 should be supported as well. I'm not quite
sure about the details here. You tests only cover 6 and 9 digits. It
would be good to cover 7 and perhaps 8 as well, since those are the
boundary cases.

Some concrete pieces of review:

+ <row>
+ <entry><literal>FF1</literal></entry>
+ <entry>decisecond (0-9)</entry>
+ </row>

Let's not use such weird terms as "deciseconds". We could say
"fractional seconds, 1 digit" etc. or something like that.

+/* Return flags for DCH_from_char() */
+#define DCH_DATED 0x01
+#define DCH_TIMED 0x02
+#define DCH_ZONED 0x04

I think you mean do_to_timestamp() here. These terms "dated" etc. are
from the SQL standard text, but they should be explained somewhere for
the readers of the code.

--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Pavel Stehule 2019-07-23 13:58:33 Re: SQL/JSON: JSON_TABLE
Previous Message Peter Eisentraut 2019-07-23 13:00:25 Re: Add CREATE DATABASE LOCALE option