diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2003-12-18 20:21:53 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2003-12-18 20:21:53 +0000 |
commit | dc254c8674c0b179fea0f04128d5d68e2c28ee99 (patch) | |
tree | a9919157f75fa798576ebae8065bb0b6df416f67 /src/backend/executor/execUtils.c | |
parent | 716a3d6cffcc2fa6b5a9e722e64911071b3bc04c (diff) | |
download | postgresql-dc254c8674c0b179fea0f04128d5d68e2c28ee99.tar.gz postgresql-dc254c8674c0b179fea0f04128d5d68e2c28ee99.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 1ee99cb359e..540e52d4b76 100644 --- a/src/backend/executor/execUtils.c +++ b/src/backend/executor/execUtils.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.106 2003/10/01 21:30:52 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/execUtils.c,v 1.106.2.1 2003/12/18 20:21:53 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, |