Re: sum() over (partition by order) question - Mailing list pgsql-hackers

From Tom Lane
Subject Re: sum() over (partition by order) question
Date
Msg-id 16310.1230764265@sss.pgh.pa.us
Whole thread Raw
In response to sum() over (partition by order) question  ("Pavel Stehule" <pavel.stehule@gmail.com>)
List pgsql-hackers
"Pavel Stehule" <pavel.stehule@gmail.com> writes:
> wrong
> postgres=# select a, b, sum(a) over (w) from foo window w as
> (partition by b order by a ROWS BETWEEN UNBOUNDED PRECEDING AND
> UNBOUNDED FOLLOWING);

Should be "over w".  "over (w)" is a <window specification> that
modifies an existing window, not just a reference, and in particular
that means we don't copy the framing clause; see SQL2008 7.11
general rule 1) b) i) 6).

Hmm... I think 7.11 syntax rule 10) e) actually wants us to throw an
error for this case, not just silently ignore the referenced window's
framing clause.  I had thought that was just being overly anal, but now
it seems that this case can result in user confusion, so maybe we'd
better throw the error after all.
        regards, tom lane


pgsql-hackers by date:

Previous
From: "Pavel Stehule"
Date:
Subject: Re: sum() over (partition by order) question
Next
From: Tom Lane
Date:
Subject: Re: sum() over (partition by order) question