Re: GROUP BY ALL

From: Andrey Borodin <amborodin86(at)gmail(dot)com>
To: Bruce Momjian <bruce(at)momjian(dot)us>
Cc: Vik Fearing <vik(at)postgresfriends(dot)org>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: GROUP BY ALL
Date: 2023-01-07 00:40:02
Message-ID: CAAhFRxhg7Z-zdjWgisbcBpnZve4qmWd=G6od4_ZutsrD0HJ6fg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On Fri, Jan 6, 2023 at 1:56 PM Bruce Momjian <bruce(at)momjian(dot)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.

In response to

Browse pgsql-hackers by date

  From Date Subject
Next Message Nathan Bossart 2023-01-07 00:45:25 Re: wake up logical workers after ALTER SUBSCRIPTION
Previous Message Justin Pryzby 2023-01-07 00:37:54 Re: Missing update of all_hasnulls in BRIN opclasses