|
1 |
| -<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.458 2008/11/13 15:59:50 petere Exp $ --> |
| 1 | +<!-- $PostgreSQL: pgsql/doc/src/sgml/func.sgml,v 1.459 2008/11/13 23:01:09 tgl Exp $ --> |
2 | 2 |
|
3 | 3 | <chapter id="functions">
|
4 | 4 | <title>Functions and Operators</title>
|
@@ -8387,8 +8387,8 @@ SELECT xmlagg(x) FROM test;
|
8387 | 8387 | </para>
|
8388 | 8388 |
|
8389 | 8389 | <para>
|
8390 |
| - The influence the order of the concatenation, something like the |
8391 |
| - following approach to sort the input values can be used: |
| 8390 | + To determine the order of the concatenation, something like the |
| 8391 | + following approach can be used: |
8392 | 8392 |
|
8393 | 8393 | <screen><![CDATA[
|
8394 | 8394 | SELECT xmlagg(x) FROM (SELECT * FROM test ORDER BY y DESC) AS tab;
|
@@ -9772,19 +9772,19 @@ SELECT count(*) FROM sometable;
|
9772 | 9772 | and <function>xmlagg</function>, as well as similar user-defined
|
9773 | 9773 | aggregate functions, produce meaningfully different result values
|
9774 | 9774 | depending on the order of the input values. In the current
|
9775 |
| - implementation, the order of the concatenation is in principle |
9776 |
| - undefined. Making the input values to be sorted in some other way |
| 9775 | + implementation, the order of the input is in principle unspecified. |
| 9776 | + Supplying the input values from a sorted subquery |
9777 | 9777 | will usually work, however. For example:
|
9778 | 9778 |
|
9779 | 9779 | <screen><![CDATA[
|
9780 |
| -SELECT xmlagg(x) FROM (SELECT * FROM test ORDER BY y DESC) AS tab; |
| 9780 | +SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab; |
9781 | 9781 | ]]></screen>
|
9782 | 9782 |
|
9783 |
| - But this approach is not guaranteed to work in all situations, and |
9784 |
| - it is not strictly SQL-conforming. A future version of PostgreSQL |
9785 |
| - might provide an additional feature to control the order in a |
9786 |
| - better-defined way (<literal>xmlagg(expr ORDER BY expr, expr, |
9787 |
| - ...</literal>). |
| 9783 | + But this syntax is not allowed in the SQL standard, and is |
| 9784 | + not portable to other database systems. A future version of |
| 9785 | + <productname>PostgreSQL</> might provide an additional feature to control |
| 9786 | + the order in a better-defined way (<literal>xmlagg(expr ORDER BY expr, expr, |
| 9787 | + ...)</literal>). |
9788 | 9788 | </para>
|
9789 | 9789 |
|
9790 | 9790 | <para>
|
|
0 commit comments