Clarify documentation about "peer" rows in window functions
authorBruce Momjian
Fri, 5 Sep 2014 22:59:41 +0000 (18:59 -0400)
committerBruce Momjian
Fri, 5 Sep 2014 22:59:41 +0000 (18:59 -0400)
Peer rows are matching rows when ORDER BY is specified.

Report by [email protected], David G Johnston

doc/src/sgml/func.sgml
doc/src/sgml/ref/select.sgml
doc/src/sgml/syntax.sgml

index daa56e99789ef2a721adb7d355e2d948a0af21f2..e50408cb977d95a86851bc79b521ce1356f8fe33 100644 (file)
@@ -13050,7 +13050,8 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab;
    Window functions provide the ability to perform
    calculations across sets of rows that are related to the current query
    row.  See  for an introduction to this
-   feature.
+   feature, and  for syntax
+   details.
   
 
   
index b69b63494b8afcc5385cbf0d049a7e0073076650..940d1aa5c0dd66b11bdc9f9c56c9e16e16d99de2 100644 (file)
@@ -792,8 +792,9 @@ UNBOUNDED FOLLOWING
     The default framing option is RANGE UNBOUNDED PRECEDING,
     which is the same as RANGE BETWEEN UNBOUNDED PRECEDING AND
     CURRENT ROW; it sets the frame to be all rows from the partition start
-    up through the current row's last peer in the ORDER BY
-    ordering (which means all rows if there is no ORDER BY).
+    up through the current row's last peer (a row that ORDER
+    BY considers equivalent to the current row, or all rows if there
+    is no ORDER BY).
     In general, UNBOUNDED PRECEDING means that the frame
     starts with the first row of the partition, and similarly
     UNBOUNDED FOLLOWING means that the frame ends with the last
@@ -817,7 +818,7 @@ UNBOUNDED FOLLOWING
     results if the ORDER BY ordering does not order the rows
     uniquely.  The RANGE options are designed to ensure that
     rows that are peers in the ORDER BY ordering are treated
-    alike; any two peer rows will be both in or both not in the frame.
+    alike; all peer rows will be in the same frame.
    
 
    
index 434a894157712dd1cf5560d2e672549d7aa1f69f..2f0680fd0bc0a27fb8456a6e5a10154bcd2ef722 100644 (file)
@@ -1877,7 +1877,7 @@ UNBOUNDED FOLLOWING
     first peer row (a row that ORDER BY considers
     equivalent to the current row), while a frame_end of
     CURRENT ROW means the frame ends with the last equivalent
-    peer.  In ROWS mode, CURRENT ROW simply means
+    ORDER BY peer.  In ROWS mode, CURRENT ROW simply means
     the current row.
    
 
@@ -1897,7 +1897,7 @@ UNBOUNDED FOLLOWING
     which is the same as RANGE BETWEEN UNBOUNDED PRECEDING AND
     CURRENT ROW.  With ORDER BY, this sets the frame to be
     all rows from the partition start up through the current row's last
-    peer.  Without ORDER BY, all rows of the partition are
+    ORDER BY peer.  Without ORDER BY, all rows of the partition are
     included in the window frame, since all rows become peers of the current
     row.