diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-12-18 20:21:37 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-12-18 20:21:37 +0000 |
commit | 38423232a5c7689bf41a9ab47086fbd6edecfd73 (patch) | |
tree | 7239519e6a9928fd0d5dba6bc18f1347b1d700ae /src/backend/executor/execUtils.c | |
parent | 125d69cd9b2a78a53b9cac811b3f028d6f1ea3d2 (diff) | |
download | postgresql-38423232a5c7689bf41a9ab47086fbd6edecfd73.tar.gz postgresql-38423232a5c7689bf41a9ab47086fbd6edecfd73.zip |
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.
Diffstat (limited to 'src/backend/executor/execUtils.c')
-rw-r--r-- | src/backend/executor/execUtils.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/src/backend/executor/execUtils.c b/src/backend/executor/execUtils.c index 2de056e1df4..cb11f4fc367 100644 --- a/src/backend/executor/execUtils.c +++ b/src/backend/executor/execUtils.c @@ -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 @@ -353,6 +354,24 @@ FreeExprContext(ExprContext *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. * * This is normally invoked via GetPerTupleExprContext() macro, |