Op 3/29/23 om 12:27 schreef Alvaro Herrera:
On 2023-Mar-28, Erik Rijkers wrote:

In the json_arrayagg() description, it says:
'If ABSENT ON NULL is specified, any NULL values are omitted.'
That's true, but as omitting NULL values is the default (i.e., also without
that clause) maybe it's better to say:
'Any NULL values are omitted unless NULL ON NULL is specified'

Doh, somehow I misread your report and modified the json_object()
documentation instead after experimenting with it (so now the
ABSENT/NULL ON NULL clause is inconsistenly described everywhere).
Would you mind submitting a patch fixing this mistake?

I think the json_object text was OK. Attached are some changes where they were needed IMHO.

Erik


... and pushed it now, after some more meddling.

I'll rebase the rest of the series now.
--- doc/src/sgml/func.sgml.orig	2023-03-29 12:45:45.013598284 +0200
+++ doc/src/sgml/func.sgml	2023-03-29 14:24:41.966456134 +0200
@@ -15830,10 +15830,10 @@
          Constructs a JSON array from either a series of
          <replaceable>value_expression</replaceable> parameters or from the results
          of <replaceable>query_expression</replaceable>,
-         which must be a SELECT query returning a single column. If
-         <literal>ABSENT ON NULL</literal> is specified, NULL values are ignored.
-         This is always the case if a
-         <replaceable>query_expression</replaceable> is used.
+         which must be a SELECT query returning a single column. 
+         If the input is a series of value_expressions, NULL values are omitted
+         unless NULL ON NULL is specified.  If a query_expression is used NULLs
+         are always ignored.
         </para>
         <para>
          <literal>json_array(1,true,json '{"a":null}')</literal>
@@ -20310,13 +20310,14 @@
         <optional> <literal>ORDER BY</literal> <replaceable>sort_expression</replaceable> </optional>
         <optional> { <literal>NULL</literal> | <literal>ABSENT</literal> } <literal>ON NULL</literal> </optional>
         <optional> <literal>RETURNING</literal> <replaceable>data_type</replaceable> <optional> <literal>FORMAT JSON</literal> <optional> <literal>ENCODING UTF8</literal> </optional> </optional> </optional>)
+        <returnvalue>json</returnvalue>
        </para>
        <para>
         Behaves in the same way as <function>json_array</function>
         but as an aggregate function so it only takes one
         <replaceable>value_expression</replaceable> parameter.
-        If <literal>ABSENT ON NULL</literal> is specified, any NULL
-        values are omitted.
+        NULL values are omitted unless </literal>NULL ON NULL</literal>
+        is specified.
         If <literal>ORDER BY</literal> is specified, the elements will
         appear in the array in that order rather than in the input order.
        </para>

Reply via email to