Re: minor doc issue in 9.16.2.1.1. Boolean Predicate Check Expressions - Mailing list pgsql-hackers

From jian he
Subject Re: minor doc issue in 9.16.2.1.1. Boolean Predicate Check Expressions
Date
Msg-id CACJufxEYY9B99bu-9HUt4LKwY4Xbq+1L-PSGQLKtsxjt7VkzhA@mail.gmail.com
Whole thread Raw
In response to minor doc issue in 9.16.2.1.1. Boolean Predicate Check Expressions  (jian he <jian.universality@gmail.com>)
List pgsql-hackers
On Fri, Oct 18, 2024 at 2:05 AM Bruce Momjian <bruce@momjian.us> wrote:
>
> On Thu, Oct 17, 2024 at 02:47:57PM -0300, Marcos Pegoraro wrote:
> > Em qui., 17 de out. de 2024 às 13:31, Bruce Momjian <bruce@momjian.us>
> > escreveu:
> >
> >     Oh, okay, but I think we need to say JSON null so we are clear --- patch
> >
> >
> > But true, false and null are all JSON, since you cannot do
> > select jsonb_path_query('{}'::jsonb,'$.track.segments[*].HR > 130') = true;
>
> Obviously, I was confused then.  This confirms the result is JSONB:
>
>         SELECT pg_typeof(jsonb_path_query('{}'::jsonb,'$.track.segments[*].HR > 130'));
>          pg_typeof
>         -----------
>          jsonb
>
> > So, it would be better to be clear that all possible returned values are JSON,
> > no ?
>
> Yes, updated patch attached.
>
looks good.

in the meantime, do you think it's necessary to slightly rephrase
jsonb_path_match doc entry:

currently doc entry:
jsonb_path_match ( target jsonb, path jsonpath [, vars jsonb [, silent
boolean ]] ) → boolean
Returns the result of a JSON path predicate check for the specified JSON value.


"the result of a JSON path predicate check for the specified JSON
value." is a jsonb boolean.
but jsonb_path_match returns sql boolean.
maybe add something to describe case like: "if JSON path predicate
check return jsonb null, jsonb_path_match will return SQL null".



pgsql-hackers by date:

Previous
From: Andrei Lepikhov
Date:
Subject: Re: Considering fractional paths in Append node
Next
From: jian he
Date:
Subject: Re: Eager aggregation, take 3