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 <br...@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.

-- 
  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 f8a0d76d12b..343e2dd9f17 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -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