Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit c0222c2

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 1510339 commit c0222c2

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
@@ -14602,7 +14602,7 @@ NULL baz</literallayout>(3 rows)</entry>
1460214602
<entry>No</entry>
1460314603
<entry>input arrays concatenated into array of one higher dimension
1460414604
(inputs must all have same dimensionality,
14605-
and cannot be empty or NULL)</entry>
14605+
and cannot be empty or null)</entry>
1460614606
</row>
1460714607

1460814608
<row>
@@ -14626,7 +14626,7 @@ NULL baz</literallayout>(3 rows)</entry>
1462614626
otherwise the same as the argument data type
1462714627
</entry>
1462814628
<entry>Yes</entry>
14629-
<entry>the average (arithmetic mean) of all input values</entry>
14629+
<entry>the average (arithmetic mean) of all non-null input values</entry>
1463014630
</row>
1463114631

1463214632
<row>
@@ -14754,7 +14754,7 @@ NULL baz</literallayout>(3 rows)</entry>
1475414754
<type>json</type>
1475514755
</entry>
1475614756
<entry>No</entry>
14757-
<entry>aggregates values as a JSON array</entry>
14757+
<entry>aggregates values, including nulls, as a JSON array</entry>
1475814758
</row>
1475914759

1476014760
<row>
@@ -14771,7 +14771,7 @@ NULL baz</literallayout>(3 rows)</entry>
1477114771
<type>jsonb</type>
1477214772
</entry>
1477314773
<entry>No</entry>
14774-
<entry>aggregates values as a JSON array</entry>
14774+
<entry>aggregates values, including nulls, as a JSON array</entry>
1477514775
</row>
1477614776

1477714777
<row>
@@ -14788,7 +14788,8 @@ NULL baz</literallayout>(3 rows)</entry>
1478814788
<type>json</type>
1478914789
</entry>
1479014790
<entry>No</entry>
14791-
<entry>aggregates name/value pairs as a JSON object</entry>
14791+
<entry>aggregates name/value pairs as a JSON object; values can be
14792+
null, but not names</entry>
1479214793
</row>
1479314794

1479414795
<row>
@@ -14805,7 +14806,8 @@ NULL baz</literallayout>(3 rows)</entry>
1480514806
<type>jsonb</type>
1480614807
</entry>
1480714808
<entry>No</entry>
14808-
<entry>aggregates name/value pairs as a JSON object</entry>
14809+
<entry>aggregates name/value pairs as a JSON object; values can be
14810+
null, but not names</entry>
1480914811
</row>
1481014812

1481114813
<row>
@@ -14821,7 +14823,7 @@ NULL baz</literallayout>(3 rows)</entry>
1482114823
<entry>Yes</entry>
1482214824
<entry>
1482314825
maximum value of <replaceable
14824-
class="parameter">expression</replaceable> across all input
14826+
class="parameter">expression</replaceable> across all non-null input
1482514827
values
1482614828
</entry>
1482714829
</row>
@@ -14839,7 +14841,7 @@ NULL baz</literallayout>(3 rows)</entry>
1483914841
<entry>Yes</entry>
1484014842
<entry>
1484114843
minimum value of <replaceable
14842-
class="parameter">expression</replaceable> across all input
14844+
class="parameter">expression</replaceable> across all non-null input
1484314845
values
1484414846
</entry>
1484514847
</row>
@@ -14861,7 +14863,7 @@ NULL baz</literallayout>(3 rows)</entry>
1486114863
same as argument types
1486214864
</entry>
1486314865
<entry>No</entry>
14864-
<entry>input values concatenated into a string, separated by delimiter</entry>
14866+
<entry>non-null input values concatenated into a string, separated by delimiter</entry>
1486514867
</row>
1486614868

1486714869
<row>
@@ -14884,7 +14886,8 @@ NULL baz</literallayout>(3 rows)</entry>
1488414886
argument data type
1488514887
</entry>
1488614888
<entry>Yes</entry>
14887-
<entry>sum of <replaceable class="parameter">expression</replaceable> across all input values</entry>
14889+
<entry>sum of <replaceable class="parameter">expression</replaceable>
14890+
across all non-null input values</entry>
1488814891
</row>
1488914892

1489014893
<row>
@@ -14901,7 +14904,8 @@ NULL baz</literallayout>(3 rows)</entry>
1490114904
<type>xml</type>
1490214905
</entry>
1490314906
<entry>No</entry>
14904-
<entry>concatenation of XML values (see also <xref linkend="functions-xml-xmlagg"/>)</entry>
14907+
<entry>concatenation of non-null XML values
14908+
(see also <xref linkend="functions-xml-xmlagg"/>)</entry>
1490514909
</row>
1490614910
</tbody>
1490714911
</tgroup>

0 commit comments

Comments
 (0)