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

Commit da1b51e

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 d4b2425 commit da1b51e

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

1461014610
<row>
@@ -14628,7 +14628,7 @@ NULL baz</literallayout>(3 rows)</entry>
1462814628
otherwise the same as the argument data type
1462914629
</entry>
1463014630
<entry>Yes</entry>
14631-
<entry>the average (arithmetic mean) of all input values</entry>
14631+
<entry>the average (arithmetic mean) of all non-null input values</entry>
1463214632
</row>
1463314633

1463414634
<row>
@@ -14756,7 +14756,7 @@ NULL baz</literallayout>(3 rows)</entry>
1475614756
<type>json</type>
1475714757
</entry>
1475814758
<entry>No</entry>
14759-
<entry>aggregates values as a JSON array</entry>
14759+
<entry>aggregates values, including nulls, as a JSON array</entry>
1476014760
</row>
1476114761

1476214762
<row>
@@ -14773,7 +14773,7 @@ NULL baz</literallayout>(3 rows)</entry>
1477314773
<type>jsonb</type>
1477414774
</entry>
1477514775
<entry>No</entry>
14776-
<entry>aggregates values as a JSON array</entry>
14776+
<entry>aggregates values, including nulls, as a JSON array</entry>
1477714777
</row>
1477814778

1477914779
<row>
@@ -14790,7 +14790,8 @@ NULL baz</literallayout>(3 rows)</entry>
1479014790
<type>json</type>
1479114791
</entry>
1479214792
<entry>No</entry>
14793-
<entry>aggregates name/value pairs as a JSON object</entry>
14793+
<entry>aggregates name/value pairs as a JSON object; values can be
14794+
null, but not names</entry>
1479414795
</row>
1479514796

1479614797
<row>
@@ -14807,7 +14808,8 @@ NULL baz</literallayout>(3 rows)</entry>
1480714808
<type>jsonb</type>
1480814809
</entry>
1480914810
<entry>No</entry>
14810-
<entry>aggregates name/value pairs as a JSON object</entry>
14811+
<entry>aggregates name/value pairs as a JSON object; values can be
14812+
null, but not names</entry>
1481114813
</row>
1481214814

1481314815
<row>
@@ -14823,7 +14825,7 @@ NULL baz</literallayout>(3 rows)</entry>
1482314825
<entry>Yes</entry>
1482414826
<entry>
1482514827
maximum value of <replaceable
14826-
class="parameter">expression</replaceable> across all input
14828+
class="parameter">expression</replaceable> across all non-null input
1482714829
values
1482814830
</entry>
1482914831
</row>
@@ -14841,7 +14843,7 @@ NULL baz</literallayout>(3 rows)</entry>
1484114843
<entry>Yes</entry>
1484214844
<entry>
1484314845
minimum value of <replaceable
14844-
class="parameter">expression</replaceable> across all input
14846+
class="parameter">expression</replaceable> across all non-null input
1484514847
values
1484614848
</entry>
1484714849
</row>
@@ -14863,7 +14865,7 @@ NULL baz</literallayout>(3 rows)</entry>
1486314865
same as argument types
1486414866
</entry>
1486514867
<entry>No</entry>
14866-
<entry>input values concatenated into a string, separated by delimiter</entry>
14868+
<entry>non-null input values concatenated into a string, separated by delimiter</entry>
1486714869
</row>
1486814870

1486914871
<row>
@@ -14886,7 +14888,8 @@ NULL baz</literallayout>(3 rows)</entry>
1488614888
argument data type
1488714889
</entry>
1488814890
<entry>Yes</entry>
14889-
<entry>sum of <replaceable class="parameter">expression</replaceable> across all input values</entry>
14891+
<entry>sum of <replaceable class="parameter">expression</replaceable>
14892+
across all non-null input values</entry>
1489014893
</row>
1489114894

1489214895
<row>
@@ -14903,7 +14906,8 @@ NULL baz</literallayout>(3 rows)</entry>
1490314906
<type>xml</type>
1490414907
</entry>
1490514908
<entry>No</entry>
14906-
<entry>concatenation of XML values (see also <xref linkend="functions-xml-xmlagg"/>)</entry>
14909+
<entry>concatenation of non-null XML values
14910+
(see also <xref linkend="functions-xml-xmlagg"/>)</entry>
1490714911
</row>
1490814912
</tbody>
1490914913
</tgroup>

0 commit comments

Comments
 (0)