The way the WINDOW clause docs are currently worded, it's clear from the grammar tree that such clauses come toward the end of the query. But this phrase made me wonder, incorrectly, whether they were supposed to come before calls to window functions, somehow:
"...where window_name is a name that can be referenced from subsequent window definitions or OVER clauses" See http://www.postgresql.org/docs/9.3/static/sql-select.html#SQL-WINDOW for the full context. I'd have preferred to see "...from OVER clauses or subsequent window definitions", which the attached simple patch does. And if I'm the only one that likes the idea of such a change, I'll gladly go away quietly. :) -- Joshua Tolley / eggyknap End Point Corporation http://www.endpoint.com
diff --git a/doc/src/sgml/ref/select.sgml b/doc/src/sgml/ref/select.sgml index 213ea09..68309ba 100644 --- a/doc/src/sgml/ref/select.sgml +++ b/doc/src/sgml/ref/select.sgml @@ -654,8 +654,8 @@ HAVING <replaceable class="parameter">condition</replaceable> WINDOW <replaceable class="parameter">window_name</replaceable> AS ( <replaceable class="parameter">window_definition</replaceable> ) [, ...] </synopsis> where <replaceable class="parameter">window_name</replaceable> is - a name that can be referenced from subsequent window definitions or - <literal>OVER</> clauses, and + a name that can be referenced from <literal>OVER</> clauses or + subsequent window definitions, and <replaceable class="parameter">window_definition</replaceable> is <synopsis> [ <replaceable class="parameter">existing_window_name</replaceable> ]
signature.asc
Description: Digital signature