postgresql/src/include/executor
Andres Freund 88e6ad3054 Fix two memory leaks around force-storing tuples in slots.
As reported by Tom, when ExecStoreMinimalTuple() had to perform a
conversion to store the minimal tuple in the slot, it forgot to
respect the shouldFree flag, and leaked the tuple into the current
memory context if true.  Fix that by freeing the tuple in that case.

Looking at the relevant code made me (Andres) realize that not having
the shouldFree parameter to ExecForceStoreHeapTuple() was a bad
idea. Some callers had to locally implement the necessary logic, and
in one case it was missing, creating a potential per-group leak in
non-hashed aggregation.

The choice to not free the tuple in ExecComputeStoredGenerated() is
not pretty, but not introduced by this commit - I'll start a separate
discussion about it.

Reported-By: Tom Lane
Discussion: https://postgr.es/m/366.1555382816@sss.pgh.pa.us
2019-04-19 11:39:56 -07:00
..
execdebug.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
execdesc.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
execExpr.h Renaming for new subscripting mechanism 2019-02-01 12:50:32 -03:00
execParallel.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
execPartition.h Allow ATTACH PARTITION with only ShareUpdateExclusiveLock. 2019-03-07 11:13:12 -05:00
executor.h tableam: Add tuple_{insert, delete, update, lock} and use. 2019-03-23 19:55:57 -07:00
functions.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
hashjoin.h Collations with nondeterministic comparison 2019-03-22 12:12:43 +01:00
instrument.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeAgg.h Change function call information to be variable length. 2019-01-26 14:17:52 -08:00
nodeAppend.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeBitmapAnd.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeBitmapHeapscan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeBitmapIndexscan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeBitmapOr.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeCtescan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeCustom.h Rename nodes/relation.h to nodes/pathnodes.h. 2019-01-29 16:49:25 -05:00
nodeForeignscan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeFunctionscan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeGather.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeGatherMerge.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeGroup.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeHash.h Collations with nondeterministic comparison 2019-03-22 12:12:43 +01:00
nodeHashjoin.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeIndexonlyscan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeIndexscan.h Don't include genam.h from execnodes.h and relscan.h anymore. 2019-01-14 17:02:12 -08:00
nodeLimit.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeLockRows.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeMaterial.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeMergeAppend.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeMergejoin.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeModifyTable.h Generated columns 2019-03-30 08:15:57 +01:00
nodeNamedtuplestorescan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeNestloop.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeProjectSet.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeRecursiveunion.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeResult.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeSamplescan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeSeqscan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeSetOp.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeSort.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeSubplan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeSubqueryscan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeTableFuncscan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeTidscan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeUnique.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeValuesscan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeWindowAgg.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
nodeWorktablescan.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
spi.h Transaction chaining 2019-03-24 11:33:02 +01:00
spi_priv.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
tablefunc.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
tqueue.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
tstoreReceiver.h Update copyright for 2019 2019-01-02 12:44:25 -05:00
tuptable.h Fix two memory leaks around force-storing tuples in slots. 2019-04-19 11:39:56 -07:00