Re: [PATCH] GROUP BY ALL - Mailing list pgsql-hackers

From Tom Lane
Subject Re: [PATCH] GROUP BY ALL
Date
Msg-id 2494010.1782828112@sss.pgh.pa.us
Whole thread
In response to Re: [PATCH] GROUP BY ALL  (Peter Eisentraut <peter@eisentraut.org>)
Responses Re: [PATCH] GROUP BY ALL
List pgsql-hackers
Peter Eisentraut <peter@eisentraut.org> writes:
>> The code in transformGroupClause() currently says:
>>      * Likewise, TLEs containing window functions are not okay to add
>>      * to GROUP BY.  At this writing, the SQL standard is silent on
>>      * what to do with them, but by analogy to aggregates we'll just
>>      * skip them.

> At the most recent SQL standard meeting, I had this issue addressed, and 
> the handling of window functions in GROUP BY ALL is now specified to 
> work like PostgreSQL already works.  I propose the attached patch that 
> updates the code comment about that, and also makes the documentation 
> more specific that we are only talking about aggregate functions and 
> window functions referring to the same query level, which is another 
> thing the original specification was silent about but which has since 
> been fixed.

Cool, thanks for seeing to that.  The proposed patch seems okay,
except that the docs wording makes it sound like outer-level window
functions are a thing, which they are not AFAIK.  You could instead
write

-    contain either an aggregate function or a window function.
+    contain either an aggregate function referring to the
+    same query level or a window function.

However, that seems to read a trifle more awkwardly, and the
distinction is quite pedantic.  If you prefer your own wording
I won't complain.

            regards, tom lane



pgsql-hackers by date:

Previous
From: Peter Eisentraut
Date:
Subject: Re: Make SPI_prepare argtypes argument const
Next
From: Tom Lane
Date:
Subject: Re: occasional ECPG failures on dikkop (FreeBSD)