@@ -1664,7 +1664,8 @@ SELECT string_agg(a ORDER BY a, ',') FROM table; -- incorrect
16641664 <para>
16651665 Placing <literal>ORDER BY</> within the aggregate's regular argument
16661666 list, as described so far, is used when ordering the input rows for
1667- a <quote>normal</> aggregate for which ordering is optional. There is a
1667+ general-purpose and statistical aggregates, for which ordering is
1668+ optional. There is a
16681669 subclass of aggregate functions called <firstterm>ordered-set
16691670 aggregates</> for which an <replaceable>order_by_clause</replaceable>
16701671 is <emphasis>required</>, usually because the aggregate's computation is
@@ -1675,15 +1676,15 @@ SELECT string_agg(a ORDER BY a, ',') FROM table; -- incorrect
16751676 inside <literal>WITHIN GROUP (...)</>, as shown in the final syntax
16761677 alternative above. The expressions in
16771678 the <replaceable>order_by_clause</replaceable> are evaluated once per
1678- input row just like normal aggregate arguments, sorted as per
1679+ input row just like regular aggregate arguments, sorted as per
16791680 the <replaceable>order_by_clause</replaceable>'s requirements, and fed
16801681 to the aggregate function as input arguments. (This is unlike the case
16811682 for a non-<literal>WITHIN GROUP</> <replaceable>order_by_clause</>,
16821683 which is not treated as argument(s) to the aggregate function.) The
16831684 argument expressions preceding <literal>WITHIN GROUP</>, if any, are
16841685 called <firstterm>direct arguments</> to distinguish them from
16851686 the <firstterm>aggregated arguments</> listed in
1686- the <replaceable>order_by_clause</replaceable>. Unlike normal aggregate
1687+ the <replaceable>order_by_clause</replaceable>. Unlike regular aggregate
16871688 arguments, direct arguments are evaluated only once per aggregate call,
16881689 not once per input row. This means that they can contain variables only
16891690 if those variables are grouped by <literal>GROUP BY</>; this restriction
@@ -1779,10 +1780,10 @@ FROM generate_series(1,10) AS s(i);
17791780 <para>
17801781 A <firstterm>window function call</firstterm> represents the application
17811782 of an aggregate-like function over some portion of the rows selected
1782- by a query. Unlike regular aggregate function calls, this is not tied
1783+ by a query. Unlike non-window aggregate calls, this is not tied
17831784 to grouping of the selected rows into a single output row — each
17841785 row remains separate in the query output. However the window function
1785- is able to scan all the rows that would be part of the current row's
1786+ has access to all the rows that would be part of the current row's
17861787 group according to the grouping specification (<literal>PARTITION BY</>
17871788 list) of the window function call.
17881789 The syntax of a window function call is one of the following:
@@ -1831,20 +1832,20 @@ UNBOUNDED FOLLOWING
18311832 named window in the <literal>WINDOW</literal> clause; see the
18321833 <xref linkend="sql-select"> reference page for details. It's worth
18331834 pointing out that <literal>OVER wname</> is not exactly equivalent to
1834- <literal>OVER (wname)</>; the latter implies copying and modifying the
1835+ <literal>OVER (wname ... )</>; the latter implies copying and modifying the
18351836 window definition, and will be rejected if the referenced window
18361837 specification includes a frame clause.
18371838 </para>
18381839
18391840 <para>
1840- The <literal>PARTITION BY</> option groups the rows of the query into
1841+ The <literal>PARTITION BY</> clause groups the rows of the query into
18411842 <firstterm>partitions</>, which are processed separately by the window
18421843 function. <literal>PARTITION BY</> works similarly to a query-level
18431844 <literal>GROUP BY</> clause, except that its expressions are always just
18441845 expressions and cannot be output-column names or numbers.
18451846 Without <literal>PARTITION BY</>, all rows produced by the query are
18461847 treated as a single partition.
1847- The <literal>ORDER BY</> option determines the order in which the rows
1848+ The <literal>ORDER BY</> clause determines the order in which the rows
18481849 of a partition are processed by the window function. It works similarly
18491850 to a query-level <literal>ORDER BY</> clause, but likewise cannot use
18501851 output-column names or numbers. Without <literal>ORDER BY</>, rows are
@@ -1921,17 +1922,17 @@ UNBOUNDED FOLLOWING
19211922 <para>
19221923 The built-in window functions are described in <xref
19231924 linkend="functions-window-table">. Other window functions can be added by
1924- the user. Also, any built-in or user-defined normal aggregate function
1925- can be used as a window function. Ordered-set aggregates presently
1926- cannot be used as window functions, however.
1925+ the user. Also, any built-in or user-defined general-purpose or
1926+ statistical aggregate can be used as a window function. ( Ordered-set
1927+ and hypothetical-set aggregates cannot presently be used as window functions.)
19271928 </para>
19281929
19291930 <para>
19301931 The syntaxes using <literal>*</> are used for calling parameter-less
19311932 aggregate functions as window functions, for example
19321933 <literal>count(*) OVER (PARTITION BY x ORDER BY y)</>.
1933- The asterisk (<literal>*</>) is customarily not used for non-aggregate window functions.
1934- Aggregate window functions, unlike normal aggregate functions, do not
1934+ The asterisk (<literal>*</>) is customarily not used for
1935+ window-specific functions. Window-specific functions do not
19351936 allow <literal>DISTINCT</> or <literal>ORDER BY</> to be used within the
19361937 function argument list.
19371938 </para>
0 commit comments