aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeNestloop.c
diff options
context:
space:
mode:
authorVadim B. Mikheev <vadim4o@yahoo.com>1998-02-13 03:26:53 +0000
committerVadim B. Mikheev <vadim4o@yahoo.com>1998-02-13 03:26:53 +0000
commit1a105cefbd4769a1ef857f94a71faed6cb76717b (patch)
tree2c9b0cf10965e5e1d31106451552aad0c7c7e18d /src/backend/executor/nodeNestloop.c
parent13637df458b1d5a4f773bd17d3b894d9ff27197b (diff)
downloadpostgresql-1a105cefbd4769a1ef857f94a71faed6cb76717b.tar.gz
postgresql-1a105cefbd4769a1ef857f94a71faed6cb76717b.zip
Support for subselects.
ExecReScan for nodeAgg, nodeHash, nodeHashjoin, nodeNestloop and nodeResult. Fixed ExecReScan for nodeMaterial. Get rid of #ifdef INDEXSCAN_PATCH. Get rid of ExecMarkPos and ExecRestrPos in nodeNestloop.
Diffstat (limited to 'src/backend/executor/nodeNestloop.c')
-rw-r--r--src/backend/executor/nodeNestloop.c48
1 files changed, 31 insertions, 17 deletions
diff --git a/src/backend/executor/nodeNestloop.c b/src/backend/executor/nodeNestloop.c
index ff9327ee994..4d1fb12cd2f 100644
--- a/src/backend/executor/nodeNestloop.c
+++ b/src/backend/executor/nodeNestloop.c
@@ -7,7 +7,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeNestloop.c,v 1.7 1997/09/08 21:43:16 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeNestloop.c,v 1.8 1998/02/13 03:26:51 vadim Exp $
*
*-------------------------------------------------------------------------
*/
@@ -86,7 +86,8 @@ ExecNestLoop(NestLoop *node, Plan *parent)
*/
econtext = nlstate->jstate.cs_ExprContext;
- /* ---------------- * get the current outer tuple
+ /* ----------------
+ * get the current outer tuple
* ----------------
*/
outerTupleSlot = nlstate->jstate.cs_OuterTupleSlot;
@@ -118,16 +119,9 @@ ExecNestLoop(NestLoop *node, Plan *parent)
*/
needNewOuterTuple = false;
- /* ----------------
- * If outer tuple is not null then that means
- * we are in the middle of a scan and we should
- * restore our previously saved scan position.
- * ----------------
- */
if (!TupIsNull(outerTupleSlot))
{
- ENL1_printf("have outer tuple, restoring outer plan");
- ExecRestrPos(outerPlan);
+ ENL1_printf("have outer tuple, deal with it");
}
else
{
@@ -179,14 +173,7 @@ ExecNestLoop(NestLoop *node, Plan *parent)
return NULL;
}
- /* ----------------
- * we have a new outer tuple so we mark our position
- * in the outer scan and save the outer tuple in the
- * NestLoop state
- * ----------------
- */
ENL1_printf("saving new outer tuple information");
- ExecMarkPos(outerPlan);
nlstate->jstate.cs_OuterTupleSlot = outerTupleSlot;
/* ----------------
@@ -385,3 +372,30 @@ ExecEndNestLoop(NestLoop *node)
NL1_printf("ExecEndNestLoop: %s\n",
"node processing ended");
}
+
+/* ----------------------------------------------------------------
+ * ExecReScanNestLoop
+ * ----------------------------------------------------------------
+ */
+void
+ExecReScanNestLoop(NestLoop *node, ExprContext *exprCtxt, Plan *parent)
+{
+ NestLoopState *nlstate = node->nlstate;
+ Plan *outerPlan = outerPlan((Plan*) node);
+
+ /*
+ * If outerPlan->chgParam is not null then plan will be
+ * automatically re-scanned by first ExecProcNode.
+ * innerPlan is re-scanned for each new outer tuple and MUST NOT
+ * be re-scanned from here or you'll get troubles from inner
+ * index scans when outer Vars are used as run-time keys...
+ */
+ if (outerPlan->chgParam == NULL)
+ ExecReScan (outerPlan, exprCtxt, (Plan *) node);
+
+ /* let outerPlan to free its result typle ... */
+ nlstate->jstate.cs_OuterTupleSlot = NULL;
+ nlstate->jstate.cs_TupFromTlist = false;
+
+ return;
+}