Skip to content

Commit fe50481

Browse files
committed
Doc: clarify behavior of standard aggregates for null inputs.
Section 4.2.7 says that unless otherwise specified, built-in aggregates ignore rows in which any input is null. This is not true of the JSON aggregates, but it wasn't documented. Fix that. Of the other entries in table 9.55, some were explicit about ignoring nulls, and some weren't; for consistency and self-contained-ness, make them all say it explicitly. Per bug #15884 from Tim Möhlmann. Back-patch to all supported branches. Discussion: https://postgr.es/m/15884-c32d848f787fcae3@postgresql.org
1 parent a5364a3 commit fe50481

File tree

1 file changed

+11
-8
lines changed

1 file changed

+11
-8
lines changed

doc/src/sgml/func.sgml

Lines changed: 11 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -12200,7 +12200,7 @@ NULL baz</literallayout>(3 rows)</entry>
1220012200
<type>double precision</type> for a floating-point argument,
1220112201
otherwise the same as the argument data type
1220212202
</entry>
12203-
<entry>the average (arithmetic mean) of all input values</entry>
12203+
<entry>the average (arithmetic mean) of all non-null input values</entry>
1220412204
</row>
1220512205

1220612206
<row>
@@ -12320,7 +12320,7 @@ NULL baz</literallayout>(3 rows)</entry>
1232012320
<entry>
1232112321
<type>json</type>
1232212322
</entry>
12323-
<entry>aggregates values as a JSON array</entry>
12323+
<entry>aggregates values, including nulls, as a JSON array</entry>
1232412324
</row>
1232512325

1232612326
<row>
@@ -12336,7 +12336,8 @@ NULL baz</literallayout>(3 rows)</entry>
1233612336
<entry>
1233712337
<type>json</type>
1233812338
</entry>
12339-
<entry>aggregates name/value pairs as a JSON object</entry>
12339+
<entry>aggregates name/value pairs as a JSON object; values can be
12340+
null, but not names</entry>
1234012341
</row>
1234112342

1234212343
<row>
@@ -12350,7 +12351,7 @@ NULL baz</literallayout>(3 rows)</entry>
1235012351
<entry>same as argument type</entry>
1235112352
<entry>
1235212353
maximum value of <replaceable
12353-
class="parameter">expression</replaceable> across all input
12354+
class="parameter">expression</replaceable> across all non-null input
1235412355
values
1235512356
</entry>
1235612357
</row>
@@ -12366,7 +12367,7 @@ NULL baz</literallayout>(3 rows)</entry>
1236612367
<entry>same as argument type</entry>
1236712368
<entry>
1236812369
minimum value of <replaceable
12369-
class="parameter">expression</replaceable> across all input
12370+
class="parameter">expression</replaceable> across all non-null input
1237012371
values
1237112372
</entry>
1237212373
</row>
@@ -12387,7 +12388,7 @@ NULL baz</literallayout>(3 rows)</entry>
1238712388
<entry>
1238812389
same as argument types
1238912390
</entry>
12390-
<entry>input values concatenated into a string, separated by delimiter</entry>
12391+
<entry>non-null input values concatenated into a string, separated by delimiter</entry>
1239112392
</row>
1239212393

1239312394
<row>
@@ -12409,7 +12410,8 @@ NULL baz</literallayout>(3 rows)</entry>
1240912410
<type>bigint</type> arguments, otherwise the same as the
1241012411
argument data type
1241112412
</entry>
12412-
<entry>sum of <replaceable class="parameter">expression</replaceable> across all input values</entry>
12413+
<entry>sum of <replaceable class="parameter">expression</replaceable>
12414+
across all non-null input values</entry>
1241312415
</row>
1241412416

1241512417
<row>
@@ -12425,7 +12427,8 @@ NULL baz</literallayout>(3 rows)</entry>
1242512427
<entry>
1242612428
<type>xml</type>
1242712429
</entry>
12428-
<entry>concatenation of XML values (see also <xref linkend="functions-xml-xmlagg">)</entry>
12430+
<entry>concatenation of non-null XML values
12431+
(see also <xref linkend="functions-xml-xmlagg">)</entry>
1242912432
</row>
1243012433
</tbody>
1243112434
</tgroup>

0 commit comments

Comments
 (0)