Re: Underspecified window queries in regression tests

From: Florian Pflug <fgp(at)phlo(dot)org>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Greg Stark <stark(at)mit(dot)edu>, pgsql-hackers(at)postgresql(dot)org, Hitoshi Harada <umi(dot)tanuki(at)gmail(dot)com>
Subject: Re: Underspecified window queries in regression tests
Date: 2011-10-16 22:51:22
Message-ID: 9ED73442-4196-4513-B641-52E91E2746B0@phlo.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Oct17, 2011, at 00:14 , Tom Lane wrote:
> Florian Pflug <fgp(at)phlo(dot)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

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2011-10-16 23:09:03 Re: Underspecified window queries in regression tests
Previous Message Tom Lane 2011-10-16 22:14:03 Re: Underspecified window queries in regression tests