1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-29 10:41:53 +03:00

Ensure set-returning functions in the targetlist of a plan node will be

shut down cleanly if the plan node is ReScanned before the SRFs are run
to completion.  This fixes the problem for SQL-language functions, but
still need work on functions using the SRF_XXX() macros.
This commit is contained in:
Tom Lane
2003-12-18 20:21:37 +00:00
parent 125d69cd9b
commit 38423232a5
3 changed files with 41 additions and 9 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/executor/execUtils.c,v 1.107 2003/11/29 19:51:48 pgsql Exp $
* $PostgreSQL: pgsql/src/backend/executor/execUtils.c,v 1.108 2003/12/18 20:21:37 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -18,6 +18,7 @@
* FreeExecutorState
* CreateExprContext
* FreeExprContext
* ReScanExprContext
*
* ExecAssignExprContext Common code for plan node init routines.
* ExecAssignResultType
@ -352,6 +353,24 @@ FreeExprContext(ExprContext *econtext)
pfree(econtext);
}
/*
* ReScanExprContext
*
* Reset an expression context in preparation for a rescan of its
* plan node. This requires calling any registered shutdown callbacks,
* since any partially complete set-returning-functions must be canceled.
*
* Note we make no assumption about the caller's memory context.
*/
void
ReScanExprContext(ExprContext *econtext)
{
/* Call any registered callbacks */
ShutdownExprContext(econtext);
/* And clean up the memory used */
MemoryContextReset(econtext->ecxt_per_tuple_memory);
}
/*
* Build a per-output-tuple ExprContext for an EState.
*