On Fri, Jan 6, 2023 at 1:56 PM Bruce Momjian <br...@momjian.us> wrote: > Because Postgres requires GROUP BY > of all non-aggregate columns of a target list, Postgres could certainly > automatically generate the GROUP BY. However, readers of the query > might not easily distinguish function calls from aggregates, so in a way > the GROUP BY is for the reader, not for the database server. >
How about "SELECT a,b, count(*) FROM t GROUP AUTOMATICALLY;" ? And then a shorthand for "SELECT a,b, count(*) FROM t GROUP;". Anyway, the problem is not in clever syntax, but in the fact that it's an SQL extension, not a standard... Best regards, Andrey Borodin.