Skip site navigation (1) Skip section navigation (2)

pgsql: In a non-hashed Agg node, reset the "aggcontext" at group

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: In a non-hashed Agg node, reset the "aggcontext" at group
Date: 2009-07-23 20:45:34
Message-ID: 20090723204534.DA65C75331E@cvs.postgresql.org (view raw or flat)
Thread:
Lists: pgsql-committers
Log Message:
-----------
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.

Tags:
----
REL8_4_STABLE

Modified Files:
--------------
    pgsql/src/backend/executor:
        nodeAgg.c (r1.167 -> r1.167.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/executor/nodeAgg.c?r1=1.167&r2=1.167.2.1)
    pgsql/src/backend/utils/adt:
        array_userfuncs.c (r1.31 -> r1.31.2.1)
        (http://anoncvs.postgresql.org/cvsweb.cgi/pgsql/src/backend/utils/adt/array_userfuncs.c?r1=1.31&r2=1.31.2.1)

pgsql-committers by date

Next:From: Tom LaneDate: 2009-07-23 21:27:10
Subject: pgsql: Save a few cycles in EXPLAIN and related commands by not
Previous:From: Tom LaneDate: 2009-07-23 20:45:27
Subject: pgsql: In a non-hashed Agg node, reset the "aggcontext" at group

Privacy Policy | About PostgreSQL
Copyright © 1996-2014 The PostgreSQL Global Development Group