Skip site navigation (1) Skip section navigation (2)

Re: sum() over (partition by order) question

From: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
To: "Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)com>
Cc: PostgreSQL-development <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: sum() over (partition by order) question
Date: 2008-12-31 22:57:45
Message-ID: 16310.1230764265@sss.pgh.pa.us (view raw or flat)
Thread:
Lists: pgsql-hackers
"Pavel Stehule" <pavel(dot)stehule(at)gmail(dot)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

In response to

pgsql-hackers by date

Next:From: James MansionDate: 2008-12-31 23:37:20
Subject: Re: About CMake
Previous:From: Jaime CasanovaDate: 2008-12-31 22:26:39
Subject: Re: sum() over (partition by order) question

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group