]> granicus.if.org Git - postgresql/commit
In a non-hashed Agg node, reset the "aggcontext" at group boundaries, instead
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 23 Jul 2009 20:45:34 +0000 (20:45 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 23 Jul 2009 20:45:34 +0000 (20:45 +0000)
commitd9988be598e7f30d1d37ec1690f6e923cb16a15e
tree0e6860268e163844161ce908758d92d23acc4a20
parentabe184101ddd5614c635566b7fa14b2d7e2a7097
In a non-hashed Agg node, reset the "aggcontext" at group boundaries, instead
of individually pfree'ing pass-by-reference transition values.  This should
be at least as fast as the prior coding, and it has the major advantage of
clearing out any working data an aggregate function may have stored in or
underneath the aggcontext.  This avoids memory leakage when an aggregate
such as array_agg() is used in GROUP BY mode.  Per report from Chris Spotts.

Back-patch to 8.4.  In principle the problem could arise in prior versions,
but since they didn't have array_agg the issue seems not critical.
src/backend/executor/nodeAgg.c
src/backend/utils/adt/array_userfuncs.c