Re: jsonpath: Missing Binary Execution Path?

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Chapman Flack <jcflack(at)acm(dot)org>
Cc: "David E(dot) Wheeler" <david(at)justatheory(dot)com>, PostgreSQL Hackers <pgsql-hackers(at)lists(dot)postgresql(dot)org>
Subject: Re: jsonpath: Missing Binary Execution Path?
Date: 2024-06-14 01:24:23
Message-ID: CAKFQuwbZ491CqcbFpin7a6Z-idC65cUJWGCL_855tQ5-90LYKg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Thu, Jun 13, 2024 at 6:10 PM Chapman Flack <jcflack(at)acm(dot)org> wrote:

> On 06/13/24 16:43, David E. Wheeler wrote:
> > Paging Mr. Eisentraut!
>
> I'm not Mr. Eisentraut, but I have at last talked my way into some
> access to the standard, so ...
>
> Note 487 emphasizes that JSON path predicates "are not expressions;
> instead they form a separate language that can only be invoked within
> a <JSON filter expression>".
>
> The only operators usable in a general expression (that is, a
> <JSON path wff> are binary + - and binary * / % and unary + -
> over a <JSON accessor expression>.
>
> Inside a filter, you get to use a <JSON path predicate>. That's where
> you can use ! and && and ||. But ! can only be applied to a
> <JSON delimited predicate>: either a <JSON exists path predicate>,
> or any other <JSON path predicate> wrapped in parentheses.
>
> On 06/13/24 11:32, David E. Wheeler wrote:
> > david=# select jsonb_path_query('true', '$ && $');
> > david=# select jsonb_path_query('true', '$.boolean() && $.boolean()');
>
> Those don't work because, as you recognized, they're not inside filters.
>

I'm content that the operators in the 'filter operators' table need to be
within filter but then I cannot reconcile why this example worked:

david=# select jsonb_path_query('1', '$ >= 1');
jsonb_path_query
------------------
true
(1 row)

David J.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Chapman Flack 2024-06-14 01:40:11 Re: jsonpath: Missing Binary Execution Path?
Previous Message Masahiko Sawada 2024-06-14 01:21:17 Re: Revive num_dead_tuples column of pg_stat_progress_vacuum