I wrote:
> Andres Freund <andres@anarazel.de> writes:
>> Think I know where the problem is - let me have a coffee and check? I think I might have a good lying around...
> I had just determined that the extra context was added by bf6c614a2,
The short answer here is that this addition to BuildTupleHashTable:
hashtable->exprcontext = CreateExprContext(parent->state);
allocates memory that is not freed by freeing the hashtable's tablecxt,
breaking the API for grouping hashtables.
Why does a hashtable need its own exprcontext now when it didn't before?
regards, tom lane