Re: Support for jsonpath .datetime() method - Mailing list pgsql-hackers

From Peter Eisentraut
Subject Re: Support for jsonpath .datetime() method
Date
Msg-id a9084f8c-7ff8-bad6-f1cc-1672446b7a75@2ndquadrant.com
Whole thread Raw
In response to Re: Support for jsonpath .datetime() method  (Alexander Korotkov <a.korotkov@postgrespro.ru>)
Responses Re: Support for jsonpath .datetime() method  (Nikita Glukhov <n.gluhov@postgrespro.ru>)
List 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



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Add CREATE DATABASE LOCALE option
Next
From: Pavel Stehule
Date:
Subject: Re: SQL/JSON: JSON_TABLE