mirror of
https://github.com/postgres/postgres.git
synced 2025-09-09 13:09:39 +03:00
Fix memory leak in ARRAY(SELECT ...) subqueries.
Repeated execution of an uncorrelated ARRAY_SUBLINK sub-select (which I think can only happen if the sub-select is embedded in a larger, correlated subquery) would leak memory for the duration of the query, due to not reclaiming the array generated in the previous execution. Per bug #6698 from Armando Miraglia. Diagnosis and fix idea by Heikki, patch itself by me. This has been like this all along, so back-patch to all supported versions.
This commit is contained in:
@@ -708,6 +708,7 @@ typedef struct SubPlanState
|
||||
ExprState *testexpr; /* state of combining expression */
|
||||
List *args; /* states of argument expression(s) */
|
||||
HeapTuple curTuple; /* copy of most recent tuple from subplan */
|
||||
Datum curArray; /* most recent array from ARRAY() subplan */
|
||||
/* these are used when hashing the subselect's output: */
|
||||
ProjectionInfo *projLeft; /* for projecting lefthand exprs */
|
||||
ProjectionInfo *projRight; /* for projecting subselect output */
|
||||
|
Reference in New Issue
Block a user