On Oct17, 2011, at 00:14 , Tom Lane wrote:
> Florian Pflug <f...@phlo.org> writes:
>> But some frame clauses (row 1 preceding, for example) have an effect despite
>> there being no ORDER BY, like here:
> 
> Yeah, why did you expect differently?  Without ORDER BY, all rows are
> peers in the frame ordering, so there's no way for a RANGE spec to
> select less than the whole partition.  But with ROWS, you can select
> less than that.

I was confused by

  When an aggregate function is used as a window function, it aggregates over
  the rows within the current row's window frame. [3.5, Window Functions].

combined with the part I quoted before, which was

 By default, if ORDER BY is supplied then the frame consists of all rows
 from the start of the partition up through the current row, plus any
 following rows that are equal to the current row according to the ORDER BY
 clause. When ORDER BY is omitted the default frame consists of all rows
 in the partition. [9.19, Window Functions, Last Paragraph]

But, reading those parts again, I realize the it says "When ORDER BY is omitted
the *default* frame consists ... ", and that the second quote is followed
by a footnote which says

  There are options to define the window frame in other ways, but this tutorial
  does not cover them. See Section 4.2.8 for details. [3.5, Window Functions]

So it was just me being thick. Sorry for the noise.

best regards,
Florian Pflug


-- 
Sent via pgsql-hackers mailing list (pgsql-hackers@postgresql.org)
To make changes to your subscription:
http://www.postgresql.org/mailpref/pgsql-hackers

Reply via email to