Fix intra-query memory leakage in nodeProjectSet.c.
authorTom Lane <tgl@sss.pgh.pa.us>
Fri, 6 Oct 2017 18:28:42 +0000 (14:28 -0400)
committerTom Lane <tgl@sss.pgh.pa.us>
Fri, 6 Oct 2017 18:28:42 +0000 (14:28 -0400)
commita1c2c430d33e0945da234b025b78bd265c8bdfb5
tree58551341e368115efa072e8b7eee155828372e92
parent6b87416c9a4dd305b76e619ecac36e2b968462f8
Fix intra-query memory leakage in nodeProjectSet.c.

Both ExecMakeFunctionResultSet() and evaluation of simple expressions
need to be done in the per-tuple memory context, not per-query, else
we leak data until end of query.  This is a consideration that was
missed while refactoring code in the ProjectSet patch (note that in
pre-v10, ExecMakeFunctionResult is called in the per-tuple context).

Per bug #14843 from Ben M.  Diagnosed independently by Andres and myself.

Discussion: https://postgr.es/m/20171005230321.28561.15927@wrigleys.postgresql.org
src/backend/executor/execSRF.c
src/backend/executor/nodeProjectSet.c