Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 1f4d107

Browse files
committed
Clarify documentation about "peer" rows in window functions
Peer rows are matching rows when ORDER BY is specified. Report by arnaud.mouronval@gmail.com, David G Johnston
1 parent a9c22d1 commit 1f4d107

File tree

3 files changed

+8
-6
lines changed

3 files changed

+8
-6
lines changed

doc/src/sgml/func.sgml

+2-1
Original file line numberDiff line numberDiff line change
@@ -13050,7 +13050,8 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab;
1305013050
<firstterm>Window functions</firstterm> provide the ability to perform
1305113051
calculations across sets of rows that are related to the current query
1305213052
row. See <xref linkend="tutorial-window"> for an introduction to this
13053-
feature.
13053+
feature, and <xref linkend="syntax-window-functions"> for syntax
13054+
details.
1305413055
</para>
1305513056

1305613057
<para>

doc/src/sgml/ref/select.sgml

+4-3
Original file line numberDiff line numberDiff line change
@@ -792,8 +792,9 @@ UNBOUNDED FOLLOWING
792792
The default framing option is <literal>RANGE UNBOUNDED PRECEDING</>,
793793
which is the same as <literal>RANGE BETWEEN UNBOUNDED PRECEDING AND
794794
CURRENT ROW</>; it sets the frame to be all rows from the partition start
795-
up through the current row's last peer in the <literal>ORDER BY</>
796-
ordering (which means all rows if there is no <literal>ORDER BY</>).
795+
up through the current row's last peer (a row that <literal>ORDER
796+
BY</> considers equivalent to the current row, or all rows if there
797+
is no <literal>ORDER BY</>).
797798
In general, <literal>UNBOUNDED PRECEDING</> means that the frame
798799
starts with the first row of the partition, and similarly
799800
<literal>UNBOUNDED FOLLOWING</> means that the frame ends with the last
@@ -817,7 +818,7 @@ UNBOUNDED FOLLOWING
817818
results if the <literal>ORDER BY</> ordering does not order the rows
818819
uniquely. The <literal>RANGE</> options are designed to ensure that
819820
rows that are peers in the <literal>ORDER BY</> ordering are treated
820-
alike; any two peer rows will be both in or both not in the frame.
821+
alike; all peer rows will be in the same frame.
821822
</para>
822823

823824
<para>

doc/src/sgml/syntax.sgml

+2-2
Original file line numberDiff line numberDiff line change
@@ -1877,7 +1877,7 @@ UNBOUNDED FOLLOWING
18771877
first <firstterm>peer</> row (a row that <literal>ORDER BY</> considers
18781878
equivalent to the current row), while a <replaceable>frame_end</> of
18791879
<literal>CURRENT ROW</> means the frame ends with the last equivalent
1880-
peer. In <literal>ROWS</> mode, <literal>CURRENT ROW</> simply means
1880+
<literal>ORDER BY</> peer. In <literal>ROWS</> mode, <literal>CURRENT ROW</> simply means
18811881
the current row.
18821882
</para>
18831883

@@ -1897,7 +1897,7 @@ UNBOUNDED FOLLOWING
18971897
which is the same as <literal>RANGE BETWEEN UNBOUNDED PRECEDING AND
18981898
CURRENT ROW</>. With <literal>ORDER BY</>, this sets the frame to be
18991899
all rows from the partition start up through the current row's last
1900-
peer. Without <literal>ORDER BY</>, all rows of the partition are
1900+
<literal>ORDER BY</> peer. Without <literal>ORDER BY</>, all rows of the partition are
19011901
included in the window frame, since all rows become peers of the current
19021902
row.
19031903
</para>

0 commit comments

Comments
 (0)