Re: Document that jsonpath == can be used as ANY

From: "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>
To: Marcos Pegoraro <marcos(at)f10(dot)com(dot)br>
Cc: pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: Document that jsonpath == can be used as ANY
Date: 2026-09-30 19:13:31
Message-ID: CAKFQuwb9emZ48OQSgZYbBt7qagrjoyqe1XLhNhNr_Jk89Bjteg@mail.gmail.com
Views: Whole Thread | Raw Message | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Wed, Sep 30, 2026 at 11:48 AM Marcos Pegoraro <marcos(at)f10(dot)com(dot)br> wrote:

> Em seg., 17 de ago. de 2026 às 09:04, Marcos Pegoraro <marcos(at)f10(dot)com(dot)br>
> escreveu:
>
>> Additional example of == operator being used like ANY
>>
>
> I insist on this, there is no documentation on how to find an array of
> values in a JSON object.
>
> select jsonb_path_query_array('[5,6,7,8,9]', '$[*] ? (@ == $arr)','{"arr":
> [2,5,8]}')
> -------
> [5, 8]
>
>
I feel like simply including an example here is insufficient. There isn't
anything special about == going on here; you can substitute >= and get a
valid result. I don't mind the example but this entire behavior of value
== value when the lefthand value is scalar and the righthand value is an
array (maybe object?) appears undefined. The sentence there - "(this, and
the other comparison operators, work on all JSON scalar values)" - in fact
implies that the array version shouldn't work.

David J.

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2026-09-30 19:24:46 Re: [PATCH] intXshr, intXshl: return error on shift count out of range
Previous Message Alexander Lakhin 2026-09-30 19:00:00 Re: [PATCH] intXshr, intXshl: return error on shift count out of range