From: Erik Wienhold <ewie@ewie.name>
To: jian he <jian.universality@gmail.com>
Cc: Adrian Klaver <adrian.klaver@aklaver.com>
Cc: pgsql-general list <pgsql-general@lists.postgresql.org>
Subject: Re: jsonb @@ jsonpath operator doc: Only the first item of the result is taken into account
Date: Tue, 4 Apr 2023 11:01:46 +0200 (CEST)
Message-ID: <880194083.579916.1680598906819@office.mailbox.org> (raw)
In-Reply-To: <CACJufxEvB3zAKcKkNLVLWfFdRHg+StY+jrFjFvwdRZduji-www@mail.gmail.com>
References: <CACJufxE01sxgvtG4QEvRZPzs_roggsZeVvBSGpjM5tzE5hMCLA@mail.gmail.com>
<202761461.525027.1680441711777@office.mailbox.org>
<48ed779b-c405-ca4f-c2d1-5ecc0312d9a3@aklaver.com>
<550248534.555107.1680534677029@office.mailbox.org>
<2f804410-376e-fc69-1829-71d4be49e39c@aklaver.com>
<1597721260.560673.1680538908417@office.mailbox.org>
<CACJufxEvB3zAKcKkNLVLWfFdRHg+StY+jrFjFvwdRZduji-www@mail.gmail.com>
> On 04/04/2023 03:50 CEST jian he <jian.universality@gmail.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."
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
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-general@postgresql.org
Cc: ewie@ewie.name, jian.universality@gmail.com, adrian.klaver@aklaver.com
Subject: Re: jsonb @@ jsonpath operator doc: Only the first item of the result is taken into account
In-Reply-To: <880194083.579916.1680598906819@office.mailbox.org>
References: <CACJufxE01sxgvtG4QEvRZPzs_roggsZeVvBSGpjM5tzE5hMCLA@mail.gmail.com> <202761461.525027.1680441711777@office.mailbox.org> <48ed779b-c405-ca4f-c2d1-5ecc0312d9a3@aklaver.com> <550248534.555107.1680534677029@office.mailbox.org> <2f804410-376e-fc69-1829-71d4be49e39c@aklaver.com> <1597721260.560673.1680538908417@office.mailbox.org> <CACJufxEvB3zAKcKkNLVLWfFdRHg+StY+jrFjFvwdRZduji-www@mail.gmail.com> <880194083.579916.1680598906819@office.mailbox.org>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox