diff options
| -rw-r--r-- | doc/src/sgml/func.sgml | 4 | ||||
| -rw-r--r-- | doc/src/sgml/syntax.sgml | 26 |
2 files changed, 18 insertions, 12 deletions
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml index 042de5b6e13..be01398b9d0 100644 --- a/doc/src/sgml/func.sgml +++ b/doc/src/sgml/func.sgml @@ -1,4 +1,4 @@ -<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.521.2.4 2010/08/17 04:37:16 petere Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.521.2.5 2010/09/01 18:22:35 tgl Exp $ --> <chapter id="functions"> <title>Functions and Operators</title> @@ -9760,7 +9760,7 @@ SELECT NULLIF(value, '(none)') ... <entry> array of the argument type </entry> - <entry>input values concatenated into an array</entry> + <entry>input values, including nulls, concatenated into an array</entry> </row> <row> diff --git a/doc/src/sgml/syntax.sgml b/doc/src/sgml/syntax.sgml index 3d108e1e46b..562568c4afa 100644 --- a/doc/src/sgml/syntax.sgml +++ b/doc/src/sgml/syntax.sgml @@ -1,4 +1,4 @@ -<!-- $PostgreSQL: pgsql/doc/src/sgml/syntax.sgml,v 1.147.2.5 2010/08/13 01:12:51 rhaas Exp $ --> +<!-- $PostgreSQL: pgsql/doc/src/sgml/syntax.sgml,v 1.147.2.6 2010/09/01 18:22:35 tgl Exp $ --> <chapter id="sql-syntax"> <title>SQL Syntax</title> @@ -1542,23 +1542,29 @@ sqrt(2) <para> The first form of aggregate expression invokes the aggregate - across all input rows for which the given expression(s) yield - non-null values. (Actually, it is up to the aggregate function - whether to ignore null values or not — but all the standard ones do.) + once for each input row. The second form is the same as the first, since - <literal>ALL</literal> is the default. The third form invokes the - aggregate for all distinct values of the expressions found - in the input rows (ignoring nulls if the function chooses to do so). - The last form invokes the aggregate once for - each input row regardless of null or non-null values; since no + <literal>ALL</literal> is the default. + The third form invokes the aggregate once for each distinct value + of the expression (or distinct set of values, for multiple expressions) + found in the input rows. + The last form invokes the aggregate once for each input row; since no particular input value is specified, it is generally only useful for the <function>count(*)</function> aggregate function. </para> <para> + Most aggregate functions ignore null inputs, so that rows in which + one or more of the expression(s) yield null are discarded. This + can be assumed to be true, unless otherwise specified, for all + built-in aggregates. + </para> + + <para> For example, <literal>count(*)</literal> yields the total number of input rows; <literal>count(f1)</literal> yields the number of - input rows in which <literal>f1</literal> is non-null; + input rows in which <literal>f1</literal> is non-null, since + <function>count</> ignores nulls; and <literal>count(distinct f1)</literal> yields the number of distinct non-null values of <literal>f1</literal>. </para> |
