Re: Freeing transient memory in aggregate functions

2021-12-21 Thread Matt Magoffin
On 21/12/2021, at 10:25 AM, Tom Lane wrote: > Not quite like that. Look into nodeAgg.c, which solves a similar problem > for the transvalues themselves with code like > >/* forget the old value, if any */ >if (!oldIsNull && !pertrans->inputtypeByVal) >pfre

Re: Freeing transient memory in aggregate functions

2021-12-20 Thread Tom Lane
Matt Magoffin writes: > I’m essentially doing a datumCopy() on every non-null input value. If you're doing that in the aggContext, you definitely need to free the prior one(s). > I was wondering if there is a way to free the previously copied datum, since > I don’t really need it anymore? Somet