From e352a005bc34d8d1a3b3529688996985001cfc62 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Tue, 27 Aug 2019 16:37:22 -0400 Subject: [PATCH] Doc: clarify behavior of standard aggregates for null inputs. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 --- doc/src/sgml/func.sgml | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 672bf5cb70..f81b163bf8 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -13513,7 +13513,7 @@ NULL baz(3 rows) No input arrays concatenated into array of one higher dimension (inputs must all have same dimensionality, - and cannot be empty or NULL) + and cannot be empty or null) @@ -13537,7 +13537,7 @@ NULL baz(3 rows) otherwise the same as the argument data type Yes - the average (arithmetic mean) of all input values + the average (arithmetic mean) of all non-null input values @@ -13665,7 +13665,7 @@ NULL baz(3 rows) json No - aggregates values as a JSON array + aggregates values, including nulls, as a JSON array @@ -13682,7 +13682,7 @@ NULL baz(3 rows) jsonb No - aggregates values as a JSON array + aggregates values, including nulls, as a JSON array @@ -13699,7 +13699,8 @@ NULL baz(3 rows) json No - aggregates name/value pairs as a JSON object + aggregates name/value pairs as a JSON object; values can be + null, but not names @@ -13716,7 +13717,8 @@ NULL baz(3 rows) jsonb No - aggregates name/value pairs as a JSON object + aggregates name/value pairs as a JSON object; values can be + null, but not names @@ -13732,7 +13734,7 @@ NULL baz(3 rows) Yes maximum value of expression across all input + class="parameter">expression across all non-null input values @@ -13750,7 +13752,7 @@ NULL baz(3 rows) Yes minimum value of expression across all input + class="parameter">expression across all non-null input values @@ -13772,7 +13774,7 @@ NULL baz(3 rows) same as argument types No - input values concatenated into a string, separated by delimiter + non-null input values concatenated into a string, separated by delimiter @@ -13795,7 +13797,8 @@ NULL baz(3 rows) argument data type Yes - sum of expression across all input values + sum of expression + across all non-null input values @@ -13812,7 +13815,8 @@ NULL baz(3 rows) xml No - concatenation of XML values (see also ) + concatenation of non-null XML values + (see also )