Re: [PATCH] GROUP BY ALL
Tom Lane <tgl@sss.pgh.pa.us>
From: Tom Lane <tgl@sss.pgh.pa.us>
To: Peter Eisentraut <peter@eisentraut.org>
Cc: pgsql-hackers <pgsql-hackers@postgresql.org>,
"David G. Johnston" <david.g.johnston@gmail.com>,
David Christensen <david@pgguru.net>,
Jelte Fennema-Nio <postgres@jeltef.nl>
Date: 2026-06-30T14:01:52Z
Lists: 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
Commits
Same data as JSON:
GET /api/v1/messages/:b64id/commits
the thread's linked commits as JSON, with link sources.
API reference →
-
Add GROUP BY ALL.
- ef38a4d9756d 19 (unreleased) landed
-
Refactor to avoid code duplication in transformPLAssignStmt.
- b0fb2c6aa5a4 19 (unreleased) landed
-
Fix missed copying of groupDistinct in transformPLAssignStmt.
- b7f6798c056a 16.11 landed
- 9ca79896aba3 15.15 landed
- 78a284b0b8d4 18.1 landed
- 7504d2be9eb4 19 (unreleased) landed
- 3fc9aa5b0233 17.7 landed
- 0be39b4b1a01 14.20 landed