Re: minor doc issue in 9.16.2.1.1. Boolean Predicate Check Expressions

From: jian he <jian(dot)universality(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Marcos Pegoraro <marcos(at)f10(dot)com(dot)br>, "David G(dot) Johnston" <david(dot)g(dot)johnston(at)gmail(dot)com>, PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: minor doc issue in 9.16.2.1.1. Boolean Predicate Check Expressions
Date: 2024-10-18 02:00:54
Message-ID: CACJufxEYY9B99bu-9HUt4LKwY4Xbq+1L-PSGQLKtsxjt7VkzhA@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Oct 18, 2024 at 2:05 AM Bruce Momjian <bruce(at)momjian(dot)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(at)momjian(dot)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".

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Zharkov Roman 2024-10-18 02:02:04 plperl version on the meson setup summary screen
Previous Message Seino Yuki 2024-10-18 01:45:24 Re: Add “FOR UPDATE NOWAIT” lock details to the log.