Re: SQL/JSON path issues/questions

From: Alexander Korotkov <a(dot)korotkov(at)postgrespro(dot)ru>
To: Thom Brown <thom(at)linux(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: SQL/JSON path issues/questions
Date: 2019-06-28 02:50:15
Message-ID: CAPpHfdtuvD8H_pHe87hHoz+ZVwP=VTHVk=X8idnB5tejHCjYqQ@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 27, 2019 at 4:57 PM Thom Brown <thom(at)linux(dot)com> wrote:
> On Wed, 19 Jun 2019 at 20:04, Alexander Korotkov
> <a(dot)korotkov(at)postgrespro(dot)ru> wrote:
> > On Wed, Jun 19, 2019 at 7:07 PM Thom Brown <thom(at)linux(dot)com> wrote:
> > > On Thu, 13 Jun 2019 at 14:59, Thom Brown <thom(at)linux(dot)com> wrote:
> > > Also, this example doesn't work:
> > >
> > > '$.track ? (@.segments[*] ? (@.HR > 130)).segments.size()'
> > >
> > > This gives me:
> > >
> > > psql: ERROR: syntax error, unexpected $end at end of jsonpath input
> > > LINE 13: }','$.track ? (@.segments[*]');
> > > ^
> >
> > Perhaps it should be following:
> >
> > '$.track ? (exists(@.segments[*] ? (@.HR > 130))).segments.size()'
>
> I'm not clear on why the original example doesn't work here.

It doesn't work because filter expression should be predicate, i.e.
always return bool. In the original example filter expression selects
some json elements. My original idea was that it was accidentally
come from some of our extensions where we've allowed that. But it
appears to be just plain wrong example, which never worked. Sorry for
that.

------
Alexander Korotkov
Postgres Professional: http://www.postgrespro.com
The Russian Postgres Company

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Alexander Korotkov 2019-06-28 03:47:59 Re: SQL/JSON path issues/questions
Previous Message Alexander Korotkov 2019-06-28 02:15:31 Re: Usage of epoch in txid_current