Re: [BUGS] We are not following the spec for HAVING without - Mailing list pgsql-hackers

From Dennis Bjorklund
Subject Re: [BUGS] We are not following the spec for HAVING without
Date
Msg-id Pine.LNX.4.44.0503141652580.16409-100000@zigo.dhs.org
Whole thread Raw
In response to Re: [BUGS] We are not following the spec for HAVING without GROUP  (Greg Stark <gsstark@mit.edu>)
Responses Re: [BUGS] We are not following the spec for HAVING without GROUP
List pgsql-hackers
On 14 Mar 2005, Greg Stark wrote:

> > SELECT ROW_NUMBER() OVER bar AS num,
> >        x, 
> >        avg(a) OVER bar,
> >        sum (a) OVER bar
> > FROM foo
> > WINDOW bar AS PARTITION BY x ORDER BY x, y, z;
> 
> Note that as you said, this returns just as many records as are in the
> original table. The OLAP functions here are just regular functions, not
> aggregate functions

They are aggregate functions, the avg() is a window aggregate function 
according to the standard. It runs over all values in the same partition.

> -- albeit functions that use data from other records other
> than the one being output.

Yes, and not just one other record, but a number of them. Isn't that what 
aggregate functions are?
Anyway, I just wanted to point to this area in the standard to tell others
what are possible using standard constructs. It doesn't really help
anything in this specific case. Pg will not have any of this implemented
in the nearest future (I guess). There is always a chance that someone see
the mail, get interested, learn about it and then implements it :-)

-- 
/Dennis Björklund



pgsql-hackers by date:

Previous
From: Greg Stark
Date:
Subject: Re: [BUGS] We are not following the spec for HAVING without GROUP
Next
From: pgsql@mohawksoft.com
Date:
Subject: Re: signed short fd