On Fri, Oct 18, 2024 at 10:00:54AM +0800, jian he wrote:
> On Fri, Oct 18, 2024 at 2:05 AM Bruce Momjian <br...@momjian.us> wrote:
> > 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".

Yes, I think that is a good point, updated patch attached.

-- 
  Bruce Momjian  <br...@momjian.us>        https://momjian.us
  EDB                                      https://enterprisedb.com

  When a patient asks the doctor, "Am I going to die?", he means 
  "Am I going to die soon?"
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 05f630c6a6c..25e445467c3 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -17178,8 +17178,8 @@ ERROR:  value too long for type character(2)
         <returnvalue>boolean</returnvalue>
        </para>
        <para>
-        Returns the result of a JSON path predicate check for the specified
-        JSON value.
+        Returns the SQL boolean result of a JSON path predicate check
+        for the specified JSON value.
         (This is useful only
         with <link linkend="functions-sqljson-check-expressions">predicate
         check expressions</link>, not SQL-standard JSON path expressions,
@@ -17646,9 +17646,9 @@ SELECT '{
      Boolean predicate, whereas the SQL standard allows predicates only within
      filters. While SQL-standard path expressions return the relevant
      element(s) of the queried JSON value, predicate check expressions
-     return the single three-valued result of the
+     return the single three-valued <type>jsonb</type> result of the
      predicate: <literal>true</literal>,
-     <literal>false</literal>, or <literal>unknown</literal>.
+     <literal>false</literal>, or <literal>null</literal>.
      For example, we could write this SQL-standard filter expression:
 <screen>
 <prompt>=&gt;</prompt> <userinput>select jsonb_path_query(:'json', '$.track.segments ?(@[*].HR &gt; 130)');</userinput>

Reply via email to