David Christensen <david(at)pgguru(dot)net> writes:
> 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.)
contain_agg_clause will blow up on a SubLink, so I doubt this is
gonna be robust.
regards, tom lane