Re: ​jsonb @@ jsonpath operator doc: ​Only the first item of the result is taken into account - Mailing list pgsql-general

From Adrian Klaver
Subject Re: ​jsonb @@ jsonpath operator doc: ​Only the first item of the result is taken into account
Date
Msg-id 2f804410-376e-fc69-1829-71d4be49e39c@aklaver.com
Whole thread Raw
In response to Re: ​jsonb @@ jsonpath operator doc: ​Only the first item of the result is taken into account  (Erik Wienhold <ewie@ewie.name>)
Responses Re: ​jsonb @@ jsonpath operator doc: ​Only the first item of the result is taken into account
List pgsql-general
On 4/3/23 08:11, Erik Wienhold wrote:
>> On 02/04/2023 17:40 CEST Adrian Klaver <adrian.klaver@aklaver.com> wrote:
>>
>> That is a long way from:
>>
>> jsonb @@ jsonpath → boolean
>>
>> Returns the result of a JSON path predicate check for the specified JSON
>> value. Only the first item of the result is taken into account. If the
>> result is not Boolean, then NULL is returned.
> 
> What do you mean?  I responded to the OP's question.  It's not a suggestion
> to update the docs.  Obviously it's quite a mouthful and needs to be boiled
> down for the docs.  Any suggestions?

For me I don't see how:

Predicates have existence semantics, because their operands are item
sequences.  Pairs of items from the left and right operand's sequences 
are checked.  TRUE returned only if any pair satisfying the condition is 
found. In strict mode, even if the desired pair has already been found, 
all pairs still need to be examined to check the absence of errors.  If 
any error occurs, UNKNOWN (analogous to SQL NULL) is returned.

resolves to :

Only the first item of the result is taken into account.

In other words reconciling "TRUE returned only if any pair satisfying 
the condition is found."  and "...first item of the result..."


> 
> --
> Erik

-- 
Adrian Klaver
adrian.klaver@aklaver.com




pgsql-general by date:

Previous
From: Tom Lane
Date:
Subject: Re: ​jsonb @@ jsonpath operator doc: ​Only the first item of the result is taken into account
Next
From: Erik Wienhold
Date:
Subject: Re: ​jsonb @@ jsonpath operator doc: ​Only the first item of the result is taken into account