Re: [BUGS] We are not following the spec for HAVING without

From: Dennis Bjorklund <db(at)zigo(dot)dhs(dot)org>
To: Greg Stark <gsstark(at)mit(dot)edu>
Cc: Bruno Wolff III <bruno(at)wolff(dot)to>, Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>, <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: [BUGS] We are not following the spec for HAVING without
Date: 2005-03-14 15:59:28
Message-ID: Pine.LNX.4.44.0503141652580.16409-100000@zigo.dhs.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-bugs 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

In response to

Responses

Browse pgsql-bugs by date

  From Date Subject
Next Message Greg Stark 2005-03-14 16:51:18 Re: [BUGS] We are not following the spec for HAVING without GROUP
Previous Message Greg Stark 2005-03-14 15:49:04 Re: [BUGS] We are not following the spec for HAVING without GROUP

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2005-03-14 16:23:36 Re: How to read query plan
Previous Message Greg Stark 2005-03-14 15:58:55 Re: How to read query plan