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/execAmi.c | |
parent | 716a3d6cffcc2fa6b5a9e722e64911071b3bc04c (diff) |
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/execAmi.c')
-rw-r--r-- | src/backend/executor/execAmi.c | 26 |
1 files changed, 19 insertions, 7 deletions
diff --git a/src/backend/executor/execAmi.c b/src/backend/executor/execAmi.c index a8eca13f1bc..703709cee07 100644 --- a/src/backend/executor/execAmi.c +++ b/src/backend/executor/execAmi.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2003, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.75 2003/08/08 21:41:34 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/execAmi.c,v 1.75.4.1 2003/12/18 20:21:53 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -39,13 +39,20 @@ #include "executor/nodeUnique.h" -/* ---------------------------------------------------------------- - * ExecReScan +/* + * ExecReScan + * Reset a plan node so that its output can be re-scanned. + * + * Note that if the plan node has parameters that have changed value, + * the output might be different from last time. * - * takes the new expression context as an argument, so that - * index scans needn't have their scan keys updated separately - * - marcel 09/20/94 - * ---------------------------------------------------------------- + * The second parameter is currently only used to pass a NestLoop plan's + * econtext down to its inner child plan, in case that is an indexscan that + * needs access to variables of the current outer tuple. (The handling of + * this parameter is currently pretty inconsistent: some callers pass NULL + * and some pass down their parent's value; so don't rely on it in other + * situations. It'd probably be better to remove the whole thing and use + * the generalized parameter mechanism instead.) */ void ExecReScan(PlanState *node, ExprContext *exprCtxt) @@ -85,6 +92,11 @@ ExecReScan(PlanState *node, ExprContext *exprCtxt) UpdateChangedParamSet(node->righttree, node->chgParam); } + /* Shut down any SRFs in the plan node's targetlist */ + if (node->ps_ExprContext) + ReScanExprContext(node->ps_ExprContext); + + /* And do node-type-specific processing */ switch (nodeTag(node)) { case T_ResultState: |