aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2019-08-27 16:37:22 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2019-08-27 16:37:22 -0400
commit890040b9c61bf3b826c494b183983d68124353fb (patch)
treed8b1daa006bb37e30ad4d949564a204e97a92510
parentef47d284dbfbd31a1c179f608942699be8b495df (diff)
downloadpostgresql-890040b9c61bf3b826c494b183983d68124353fb.tar.gz
postgresql-890040b9c61bf3b826c494b183983d68124353fb.zip
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
-rw-r--r--doc/src/sgml/func.sgml26
1 files changed, 15 insertions, 11 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 0417f2a2f65..6d7c2afe8fc 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -12467,7 +12467,7 @@ NULL baz</literallayout>(3 rows)</entry>
</entry>
<entry>input arrays concatenated into array of one higher dimension
(inputs must all have same dimensionality,
- and cannot be empty or NULL)</entry>
+ and cannot be empty or null)</entry>
</row>
<row>
@@ -12490,7 +12490,7 @@ NULL baz</literallayout>(3 rows)</entry>
<type>double precision</type> for a floating-point argument,
otherwise the same as the argument data type
</entry>
- <entry>the average (arithmetic mean) of all input values</entry>
+ <entry>the average (arithmetic mean) of all non-null input values</entry>
</row>
<row>
@@ -12610,7 +12610,7 @@ NULL baz</literallayout>(3 rows)</entry>
<entry>
<type>json</type>
</entry>
- <entry>aggregates values as a JSON array</entry>
+ <entry>aggregates values, including nulls, as a JSON array</entry>
</row>
<row>
@@ -12626,7 +12626,7 @@ NULL baz</literallayout>(3 rows)</entry>
<entry>
<type>jsonb</type>
</entry>
- <entry>aggregates values as a JSON array</entry>
+ <entry>aggregates values, including nulls, as a JSON array</entry>
</row>
<row>
@@ -12642,7 +12642,8 @@ NULL baz</literallayout>(3 rows)</entry>
<entry>
<type>json</type>
</entry>
- <entry>aggregates name/value pairs as a JSON object</entry>
+ <entry>aggregates name/value pairs as a JSON object; values can be
+ null, but not names</entry>
</row>
<row>
@@ -12658,7 +12659,8 @@ NULL baz</literallayout>(3 rows)</entry>
<entry>
<type>jsonb</type>
</entry>
- <entry>aggregates name/value pairs as a JSON object</entry>
+ <entry>aggregates name/value pairs as a JSON object; values can be
+ null, but not names</entry>
</row>
<row>
@@ -12673,7 +12675,7 @@ NULL baz</literallayout>(3 rows)</entry>
<entry>same as argument type</entry>
<entry>
maximum value of <replaceable
- class="parameter">expression</replaceable> across all input
+ class="parameter">expression</replaceable> across all non-null input
values
</entry>
</row>
@@ -12690,7 +12692,7 @@ NULL baz</literallayout>(3 rows)</entry>
<entry>same as argument type</entry>
<entry>
minimum value of <replaceable
- class="parameter">expression</replaceable> across all input
+ class="parameter">expression</replaceable> across all non-null input
values
</entry>
</row>
@@ -12711,7 +12713,7 @@ NULL baz</literallayout>(3 rows)</entry>
<entry>
same as argument types
</entry>
- <entry>input values concatenated into a string, separated by delimiter</entry>
+ <entry>non-null input values concatenated into a string, separated by delimiter</entry>
</row>
<row>
@@ -12733,7 +12735,8 @@ NULL baz</literallayout>(3 rows)</entry>
<type>bigint</type> arguments, otherwise the same as the
argument data type
</entry>
- <entry>sum of <replaceable class="parameter">expression</replaceable> across all input values</entry>
+ <entry>sum of <replaceable class="parameter">expression</replaceable>
+ across all non-null input values</entry>
</row>
<row>
@@ -12749,7 +12752,8 @@ NULL baz</literallayout>(3 rows)</entry>
<entry>
<type>xml</type>
</entry>
- <entry>concatenation of XML values (see also <xref linkend="functions-xml-xmlagg">)</entry>
+ <entry>concatenation of non-null XML values
+ (see also <xref linkend="functions-xml-xmlagg">)</entry>
</row>
</tbody>
</tgroup>