Re: Support for jsonpath .datetime() method
Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
From: Peter Eisentraut <peter.eisentraut@2ndquadrant.com>
To: Nikita Glukhov <n.gluhov@postgrespro.ru>,
Alexander Korotkov <a.korotkov@postgrespro.ru>,
PostgreSQL Hackers <pgsql-hackers@lists.postgresql.org>
Cc: Liudmila Mantrova <l.mantrova@postgrespro.ru>,
Anastasia Lubennikova <lubennikovaav@gmail.com>
Date: 2019-07-24T20:25:08Z
Lists: pgsql-hackers
On 2019-07-24 00:48, Nikita Glukhov wrote:
> It seems that our YY works like RR should:
>
> SELECT to_date('69', 'YY');
> to_date
> ------------
> 2069-01-01
> (1 row)
>
> SELECT to_date('70', 'YY');
> to_date
> ------------
> 1970-01-01
> (1 row)
>
> But by the standard first two digits of current year should be used in YY.
Is this behavior even documented anywhere in our documentation? I
couldn't find it. What's the exact specification of what it does in
these cases?
> So it's unclear what we should do:
> - implement YY and RR strictly following the standard only in .datetime()
> - fix YY implementation in to_date()/to_timestamp() and implement RR
> - use our non-standard templates in .datetime()
I think we definitely should try to use the same template system in both
the general functions and in .datetime(). This might involve some
compromises between existing behavior, Oracle behavior, SQL standard.
So far I'm not worried: If you're using two-digit years like above,
you're playing with fire anyway. Also some of the other cases like
dealing with trailing spaces are probably acceptable as slight
incompatibilities or extensions.
We should collect a list of test cases that illustrate the differences
and then work out how to deal with them.
--
Peter Eisentraut http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services
Commits
-
Allow datetime values in JsonbValue
- 6dda292d4df8 13.0 landed
-
Error suppression support for upcoming jsonpath .datetime() method
- 5bc450629b31 13.0 landed
-
Implement jsonpath .datetime() method
- bffe1bd68457 13.0 landed
-
Implement parse_datetime() function
- 66c74f8b6e34 13.0 landed
-
Implement standard datetime parsing mode
- 1a950f37d0a2 13.0 landed
-
Support for SSSSS datetime format pattern
- b64b857f50fb 13.0 landed
-
Support for FF1-FF6 datetime format patterns
- d589f94460c2 13.0 landed