Added documentation for function xmlagg.
authorPeter Eisentraut
Mon, 7 Jul 2008 16:11:35 +0000 (16:11 +0000)
committerPeter Eisentraut
Mon, 7 Jul 2008 16:11:35 +0000 (16:11 +0000)
doc/src/sgml/func.sgml

index d3529f560e3db0ff4a5dbcd2b22a2084aeb5b995..66e43f1399c8c99bf6dcfe013dfc7cc7ba829efd 100644 (file)
@@ -1,4 +1,4 @@
-
+
 
  
   Functions and Operators
@@ -8339,6 +8339,60 @@ SELECT xmlroot(xmlparse(document 'abc'),
     
    
 
+   
+    <literal>xmlagg</literal>
+
+    
+     xmlagg
+    
+
+
+xmlagg(xml)
+
+
+    
+     The function xmlagg is, unlike the other
+     functions below, an aggregate function.  It concatenates the
+     input values to the aggregate function call,
+     like xmlconcat does.
+     See  for general information
+     about aggregate functions.
+    
+
+    
+     Example:
+
+CREATE TABLE test (y int, x xml);
+INSERT INTO test VALUES (1, 'abc');
+INSERT INTO test VALUES (2, '');
+SELECT xmlagg(x) FROM test;
+        xmlagg
+----------------------
abc
+]]>
+    
+
+    
+     Note that in the current implementation, the order of the
+     concatenation is in principle undefined.  Making the input values
+     to be sorted in some other way will usually work, however.  For
+     instance, in the above example, one could influence the order
+     like so:
+
+SELECT xmlagg(x) FROM (SELECT * FROM test ORDER BY y DESC) AS tab;
+        xmlagg
+----------------------
abc
+]]>
+
+     But this approach is not guaranteed to work in all situations and
+     in all versions of PostgreSQL.  A future version of PostgreSQL
+     will probably provide an additional feature to control the order
+     in a proper way (xmlagg(expr ORDER BY expr, expr,
+     ...).
+    
+   
+
    
     XML Predicates