Re: [PATCH] GROUP BY ALL

David Christensen <david@pgguru.net>

From: David Christensen <david@pgguru.net>
To: jian he <jian.universality@gmail.com>
Cc: Andrey Borodin <x4mmm@yandex-team.ru>, Peter Eisentraut <peter@eisentraut.org>, pgsql-hackers <pgsql-hackers@postgresql.org>, Tom Lane <tgl@sss.pgh.pa.us>, "David G. Johnston" <david.g.johnston@gmail.com>, Jelte Fennema-Nio <postgres@jeltef.nl>
Date: 2025-09-26T17:00:01Z
Lists: pgsql-hackers

Commits

Same data as JSON: GET /api/v1/messages/:b64id/commits the thread's linked commits as JSON, with link sources. API reference →
  1. Add GROUP BY ALL.

  2. Refactor to avoid code duplication in transformPLAssignStmt.

  3. Fix missed copying of groupDistinct in transformPLAssignStmt.

Attachments

Version 3 of this patch, incorporating some of the feedback thus far:


On Fri, Sep 26, 2025 at 11:56 AM David Christensen <david@pgguru.net> wrote:
>
> On Fri, Sep 26, 2025 at 11:38 AM jian he <jian.universality@gmail.com> wrote:
> >
> > On Fri, Sep 26, 2025 at 11:46 PM David Christensen <david@pgguru.net> wrote:
> > >
> > > >
> > > > I’m interested in picking it up again but would appreciate the review.
> > >
> > > Here is a rebased version with a few more tests.  I also changed the
> > > main check here to using `!contain_agg_clause` instead of
> > > `!IsA(Aggref))` directly.  (This was defined in `optimizer/clauses.h`,
> > > but we already are pulling in `optimizer.h`, so it felt valid to me.)
> > >
> >
> > hi.
> > I only briefly browse the patch text file, so forgive me.
> > seems missing deparse regress tests
> >
> > i think you may need one test like:
> >
> > create view v1 as SELECT b, COUNT(*) FROM t1 GROUP BY ALL;
> > \sv v1
>
> Thanks, good suggestion; not sure the appropriate final location for
> this, but it did show a bug in the current patch.
>
> David