Re: pgsql: Implement jsonpath .datetime() method

2019-10-19 Thread Alexander Korotkov
On Mon, Oct 14, 2019 at 5:36 AM Alexander Korotkov wrote: > On Sun, Oct 13, 2019 at 5:24 AM Tom Lane wrote: > > Alexander Korotkov writes: > > > This patch also changes the way timestamp to timestamptz cast works. > > > Previously it did timestamp2tm() then tm2timestamp(). Instead, after > > >

Re: pgsql: Implement jsonpath .datetime() method

2019-10-13 Thread Alexander Korotkov
On Sun, Oct 13, 2019 at 5:24 AM Tom Lane wrote: > Alexander Korotkov writes: > > This patch also changes the way timestamp to timestamptz cast works. > > Previously it did timestamp2tm() then tm2timestamp(). Instead, after > > timestamp2tm() it calculates timezone offset and applies it to > > or

Re: pgsql: Implement jsonpath .datetime() method

2019-10-12 Thread Tom Lane
Alexander Korotkov writes: > This patch also changes the way timestamp to timestamptz cast works. > Previously it did timestamp2tm() then tm2timestamp(). Instead, after > timestamp2tm() it calculates timezone offset and applies it to > original timestamp value. I hope this is correct. I'd wonde

Re: pgsql: Implement jsonpath .datetime() method

2019-10-12 Thread Alexander Korotkov
On Thu, Oct 3, 2019 at 4:48 PM Robert Haas wrote: > On Tue, Oct 1, 2019 at 1:41 PM Alexander Korotkov > wrote: > > So, basically standard requires us to suppress any error happening in > > filter expression. > > Sounds like the standard is dumb, then. :-) > > > But as I wrote before suppression o

Re: pgsql: Implement jsonpath .datetime() method

2019-10-03 Thread Robert Haas
On Tue, Oct 1, 2019 at 1:41 PM Alexander Korotkov wrote: > So, basically standard requires us to suppress any error happening in > filter expression. Sounds like the standard is dumb, then. :-) > But as I wrote before suppression of errors in > datetime comparison may lead to surprising results.

Re: pgsql: Implement jsonpath .datetime() method

2019-10-01 Thread Alexander Korotkov
On Mon, Sep 30, 2019 at 10:56 PM Robert Haas wrote: > On Sun, Sep 29, 2019 at 10:30 AM Alexander Korotkov > wrote: > > So, jsonpath behaves like 100 is not greater than 2020. This > > looks like plain false. And user can't expect that unless she is > > familiar with our particular issues.

Re: pgsql: Implement jsonpath .datetime() method

2019-09-30 Thread Robert Haas
On Sun, Sep 29, 2019 at 10:30 AM Alexander Korotkov wrote: > So, jsonpath behaves like 100 is not greater than 2020. This > looks like plain false. And user can't expect that unless she is > familiar with our particular issues. Now I got opinion that such > errors shouldn't be suppressed.

Re: pgsql: Implement jsonpath .datetime() method

2019-09-29 Thread Alexander Korotkov
On Fri, Sep 27, 2019 at 6:58 PM Nikita Glukhov wrote: > On Thu, Sep 26, 2019 at 2:57 AM Tom Lane > wrote: > > * More generally, it's completely unclear why some error conditions > > are thrown as errors and others just result in returning *have_error. > > In particular, it seems weird that some

Re: pgsql: Implement jsonpath .datetime() method

2019-09-27 Thread Nikita Glukhov
On Thu, Sep 26, 2019 at 2:57 AM Tom Lane wrote: Alexander Korotkov writes: > On Thu, Sep 26, 2019 at 2:12 AM Tom Lane wrote: >> The proximate problem seems to be that compareItems() is insufficiently >> careful to ensure that both values are non-null before passing them >> off to datatype-sp

Re: pgsql: Implement jsonpath .datetime() method

2019-09-25 Thread Alexander Korotkov
On Thu, Sep 26, 2019 at 2:57 AM Tom Lane wrote: > Alexander Korotkov writes: > > On Thu, Sep 26, 2019 at 2:12 AM Tom Lane wrote: > >> The proximate problem seems to be that compareItems() is insufficiently > >> careful to ensure that both values are non-null before passing them > >> off to datat

Re: pgsql: Implement jsonpath .datetime() method

2019-09-25 Thread Tom Lane
Alexander Korotkov writes: > On Thu, Sep 26, 2019 at 2:12 AM Tom Lane wrote: >> The proximate problem seems to be that compareItems() is insufficiently >> careful to ensure that both values are non-null before passing them >> off to datatype-specific code. The code accidentally fails to crash >>

Re: pgsql: Implement jsonpath .datetime() method

2019-09-25 Thread Alexander Korotkov
On Thu, Sep 26, 2019 at 2:12 AM Tom Lane wrote: > Alexander Korotkov writes: > > I've noticed buildfarm is unhappy with my commits. > > The proximate problem seems to be that compareItems() is insufficiently > careful to ensure that both values are non-null before passing them > off to datatype-s

Re: pgsql: Implement jsonpath .datetime() method

2019-09-25 Thread Tom Lane
Alexander Korotkov writes: > I've noticed buildfarm is unhappy with my commits. The proximate problem seems to be that compareItems() is insufficiently careful to ensure that both values are non-null before passing them off to datatype-specific code. The code accidentally fails to crash on 64-bi

Re: pgsql: Implement jsonpath .datetime() method

2019-09-25 Thread Alexander Korotkov
On Thu, Sep 26, 2019 at 12:05 AM Alexander Korotkov < a.korot...@postgrespro.ru> wrote: > > On Wed, Sep 25, 2019 at 10:52 PM Alexander Korotkov > wrote: > > Implement jsonpath .datetime() method > > I've noticed buildfarm is unhappy with my commits. > > 1. https://buildfarm.postgresql.org/cgi-bin/

Re: pgsql: Implement jsonpath .datetime() method

2019-09-25 Thread Alexander Korotkov
On Wed, Sep 25, 2019 at 10:52 PM Alexander Korotkov wrote: > Implement jsonpath .datetime() method I've noticed buildfarm is unhappy with my commits. 1. https://buildfarm.postgresql.org/cgi-bin/show_log.pl?nm=lapwing&dt=2019-09-25%2020%3A40%3A11 2. https://buildfarm.postgresql.org/cgi-bin/show

pgsql: Implement jsonpath .datetime() method

2019-09-25 Thread Alexander Korotkov
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 ve