Re: ​jsonb @@ jsonpath operator doc: ​Only the first item of the result is taken into account

From: Adrian Klaver <adrian(dot)klaver(at)aklaver(dot)com>
To: Erik Wienhold <ewie(at)ewie(dot)name>, jian he <jian(dot)universality(at)gmail(dot)com>
Cc: pgsql-general list <pgsql-general(at)lists(dot)postgresql(dot)org>
Subject: Re: ​jsonb @@ jsonpath operator doc: ​Only the first item of the result is taken into account
Date: 2023-04-04 15:12:52
Message-ID: 985e55f9-0619-5ee9-ae87-b8d5248cb8a7@aklaver.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 4/4/23 02:01, Erik Wienhold wrote:
>> On 04/04/2023 03:50 CEST jian he <jian(dot)universality(at)gmail(dot)com> wrote:
>>
>>> "Returns true if any JSON value at the given path matches the predicate.
>>> Returns NULL when not a path predicate or comparing different types."
>>
>> in first sentence, should we add something "otherwise return false." ?
>
> I omitted the "otherwise false" part because of the corner cases which I did
> not want to gloss over. But the corner cases also apply if the predicate
> matches some value, depending on strict mode, as I noticed later and wrote in
> my previous message.
>
> Suggestion:
>
> "Returns true if any JSON value at the given path matches the predicate,
> otherwise returns false. Unless the predicate compares different types
> (depending on strict mode) or the jsonpath is not a path predicate, in
> which case NULL is returned."

That I understand. Thanks.

>
> I guess it's best to document the corner cases in detail in the notes section
> as Adrian pointed out and have the function doc refer to the notes.
>
>> also, should it be "Return true"? (since only one value returned)?
>
> The third-person singular "returns" is correct in this case. It does not refer
> to the number of returned values.
>
> --
> Erik

--
Adrian Klaver
adrian(dot)klaver(at)aklaver(dot)com

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tatsuo Ishii 2023-04-04 23:00:58 Re: Patroni vs pgpool II
Previous Message cen 2023-04-04 13:40:44 Re: Patroni vs pgpool II