Fix memory leak created by deferrable-index-constraints patches.
We need to free the OID list returned by ExecInsertIndexTuples to avoid a query-lifespan memory leak. When many rows require rechecking, this can be a significant leak --- it's even more than the space used for the queued trigger events. Dean Rasheed
This commit is contained in:
parent
f13944e9c9
commit
034fffbf31
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.321 2010/01/15 09:19:01 heikki Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/commands/copy.c,v 1.322 2010/01/31 18:15:39 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -2172,6 +2172,8 @@ CopyFrom(CopyState cstate)
|
||||
ExecARInsertTriggers(estate, resultRelInfo, tuple,
|
||||
recheckIndexes);
|
||||
|
||||
list_free(recheckIndexes);
|
||||
|
||||
/*
|
||||
* We count only tuples not suppressed by a BEFORE INSERT trigger;
|
||||
* this is the same definition used by execMain.c for counting
|
||||
|
@ -8,7 +8,7 @@
|
||||
*
|
||||
*
|
||||
* IDENTIFICATION
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeModifyTable.c,v 1.4 2010/01/02 16:57:44 momjian Exp $
|
||||
* $PostgreSQL: pgsql/src/backend/executor/nodeModifyTable.c,v 1.5 2010/01/31 18:15:39 tgl Exp $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -254,6 +254,8 @@ ExecInsert(TupleTableSlot *slot,
|
||||
/* AFTER ROW INSERT Triggers */
|
||||
ExecARInsertTriggers(estate, resultRelInfo, tuple, recheckIndexes);
|
||||
|
||||
list_free(recheckIndexes);
|
||||
|
||||
/* Process RETURNING if present */
|
||||
if (resultRelInfo->ri_projectReturning)
|
||||
return ExecProcessReturning(resultRelInfo->ri_projectReturning,
|
||||
@ -570,6 +572,8 @@ lreplace:;
|
||||
ExecARUpdateTriggers(estate, resultRelInfo, tupleid, tuple,
|
||||
recheckIndexes);
|
||||
|
||||
list_free(recheckIndexes);
|
||||
|
||||
/* Process RETURNING if present */
|
||||
if (resultRelInfo->ri_projectReturning)
|
||||
return ExecProcessReturning(resultRelInfo->ri_projectReturning,
|
||||
|
Loading…
x
Reference in New Issue
Block a user