windows-function-doc.patch
text/x-patch
Filename: windows-function-doc.patch
Type: text/x-patch
Part: 0
Patch
Same data as JSON:
GET /api/v1/attachments/:id/patch
the parsed metadata as JSON — format, series position, per-file stats; never the diff bytes.
API reference →
Format: unified
| File | + | − |
|---|---|---|
| doc/src/sgml/func.sgml | 25 | 0 |
diff --git a/doc/src/sgml/func.sgml b/doc/src/sgml/func.sgml
index 183b72c..7bcbe25 100644
--- a/doc/src/sgml/func.sgml
+++ b/doc/src/sgml/func.sgml
@@ -10684,6 +10684,30 @@ SELECT xmlagg(x) FROM (SELECT x FROM test ORDER BY y DESC) AS tab;
clause follows the call; otherwise they act as regular aggregates.
</para>
+ <para>
+ The evaluation order may be tricky for Window Functions when used in conjunction
+ with a <literal>LIMIT</> clause. The <literal>WHERE</> clause is evaluated
+ first then the Window Function and last the <literal>LIMIT</> is applied.
+ An example:
+ </para>
+
+<screen>
+# select * from testtable;
+ id | value
+----+-------
+ 1 | 1
+ 2 | 2
+ 3 | 3
+(3 rows)
+
+# select id,max(id) over () from testtable order by id asc limit 2;
+ id | max
+----+-----
+ 1 | 3
+ 2 | 3
+(2 rows)
+</screen>
+
+
<table id="functions-window-table">
<title>General-Purpose Window Functions</title>