On Mon, Jun 22, 2020 at 9:02 PM Andres Freund <andres@anarazel.de> wrote:
> /* > - * find_unaggregated_cols > - * Construct a bitmapset of the column numbers of un-aggregated Vars > - * appearing in our targetlist and qual (HAVING clause) > + * Walk tlist and qual to find referenced colnos, dividing them into > + * aggregated and unaggregated sets. > */ > -static Bitmapset * > -find_unaggregated_cols(AggState *aggstate) > +static void > +find_cols(AggState *aggstate, Bitmapset **aggregated, Bitmapset **unaggregated) > {
It's not this patch's fault, but none, really none, of this stuff should be in the executor.
Were you thinking it could be done in grouping_planner() and then the bitmaps could be saved in the PlannedStmt? Or would you have to wait until query_planner()? Or are you imagining somewhere else entirely?