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".