Skip to content

Commit f2cf22a

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 771e127 commit f2cf22a

File tree

1 file changed

+15
-11
lines changed

1 file changed

+15
-11
lines changed

doc/src/sgml/func.sgml

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -13371,7 +13371,7 @@ NULL baz</literallayout>(3 rows)</entry>
1337113371
<entry>No</entry>
1337213372
<entry>input arrays concatenated into array of one higher dimension
1337313373
(inputs must all have same dimensionality,
13374-
and cannot be empty or NULL)</entry>
13374+
and cannot be empty or null)</entry>
1337513375
</row>
1337613376

1337713377
<row>
@@ -13395,7 +13395,7 @@ NULL baz</literallayout>(3 rows)</entry>
1339513395
otherwise the same as the argument data type
1339613396
</entry>
1339713397
<entry>Yes</entry>
13398-
<entry>the average (arithmetic mean) of all input values</entry>
13398+
<entry>the average (arithmetic mean) of all non-null input values</entry>
1339913399
</row>
1340013400

1340113401
<row>
@@ -13523,7 +13523,7 @@ NULL baz</literallayout>(3 rows)</entry>
1352313523
<type>json</type>
1352413524
</entry>
1352513525
<entry>No</entry>
13526-
<entry>aggregates values as a JSON array</entry>
13526+
<entry>aggregates values, including nulls, as a JSON array</entry>
1352713527
</row>
1352813528

1352913529
<row>
@@ -13540,7 +13540,7 @@ NULL baz</literallayout>(3 rows)</entry>
1354013540
<type>jsonb</type>
1354113541
</entry>
1354213542
<entry>No</entry>
13543-
<entry>aggregates values as a JSON array</entry>
13543+
<entry>aggregates values, including nulls, as a JSON array</entry>
1354413544
</row>
1354513545

1354613546
<row>
@@ -13557,7 +13557,8 @@ NULL baz</literallayout>(3 rows)</entry>
1355713557
<type>json</type>
1355813558
</entry>
1355913559
<entry>No</entry>
13560-
<entry>aggregates name/value pairs as a JSON object</entry>
13560+
<entry>aggregates name/value pairs as a JSON object; values can be
13561+
null, but not names</entry>
1356113562
</row>
1356213563

1356313564
<row>
@@ -13574,7 +13575,8 @@ NULL baz</literallayout>(3 rows)</entry>
1357413575
<type>jsonb</type>
1357513576
</entry>
1357613577
<entry>No</entry>
13577-
<entry>aggregates name/value pairs as a JSON object</entry>
13578+
<entry>aggregates name/value pairs as a JSON object; values can be
13579+
null, but not names</entry>
1357813580
</row>
1357913581

1358013582
<row>
@@ -13590,7 +13592,7 @@ NULL baz</literallayout>(3 rows)</entry>
1359013592
<entry>Yes</entry>
1359113593
<entry>
1359213594
maximum value of <replaceable
13593-
class="parameter">expression</replaceable> across all input
13595+
class="parameter">expression</replaceable> across all non-null input
1359413596
values
1359513597
</entry>
1359613598
</row>
@@ -13608,7 +13610,7 @@ NULL baz</literallayout>(3 rows)</entry>
1360813610
<entry>Yes</entry>
1360913611
<entry>
1361013612
minimum value of <replaceable
13611-
class="parameter">expression</replaceable> across all input
13613+
class="parameter">expression</replaceable> across all non-null input
1361213614
values
1361313615
</entry>
1361413616
</row>
@@ -13630,7 +13632,7 @@ NULL baz</literallayout>(3 rows)</entry>
1363013632
same as argument types
1363113633
</entry>
1363213634
<entry>No</entry>
13633-
<entry>input values concatenated into a string, separated by delimiter</entry>
13635+
<entry>non-null input values concatenated into a string, separated by delimiter</entry>
1363413636
</row>
1363513637

1363613638
<row>
@@ -13653,7 +13655,8 @@ NULL baz</literallayout>(3 rows)</entry>
1365313655
argument data type
1365413656
</entry>
1365513657
<entry>Yes</entry>
13656-
<entry>sum of <replaceable class="parameter">expression</replaceable> across all input values</entry>
13658+
<entry>sum of <replaceable class="parameter">expression</replaceable>
13659+
across all non-null input values</entry>
1365713660
</row>
1365813661

1365913662
<row>
@@ -13670,7 +13673,8 @@ NULL baz</literallayout>(3 rows)</entry>
1367013673
<type>xml</type>
1367113674
</entry>
1367213675
<entry>No</entry>
13673-
<entry>concatenation of XML values (see also <xref linkend="functions-xml-xmlagg">)</entry>
13676+
<entry>concatenation of non-null XML values
13677+
(see also <xref linkend="functions-xml-xmlagg">)</entry>
1367413678
</row>
1367513679
</tbody>
1367613680
</tgroup>

0 commit comments

Comments
 (0)