aboutsummaryrefslogtreecommitdiff
path: root/src/backend/executor/nodeNestloop.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2000-08-24 03:29:15 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2000-08-24 03:29:15 +0000
commit782c16c6a154e760bf1608d633488538cd52da93 (patch)
tree902da787593da21a979bd2f74b0b44acf9c427b0 /src/backend/executor/nodeNestloop.c
parent87523ab8db34859ae3fb980a3fab9f29dfc4c97a (diff)
downloadpostgresql-782c16c6a154e760bf1608d633488538cd52da93.tar.gz
postgresql-782c16c6a154e760bf1608d633488538cd52da93.zip
SQL-language functions are now callable in ordinary fmgr contexts ...
for example, an SQL function can be used in a functional index. (I make no promises about speed, but it'll work ;-).) Clean up and simplify handling of functions returning sets.
Diffstat (limited to 'src/backend/executor/nodeNestloop.c')
-rw-r--r--src/backend/executor/nodeNestloop.c35
1 files changed, 19 insertions, 16 deletions
diff --git a/src/backend/executor/nodeNestloop.c b/src/backend/executor/nodeNestloop.c
index f59c1b0f602..3685232c7e4 100644
--- a/src/backend/executor/nodeNestloop.c
+++ b/src/backend/executor/nodeNestloop.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/executor/nodeNestloop.c,v 1.19 2000/08/13 02:50:03 tgl Exp $
+ * $Header: /cvsroot/pgsql/src/backend/executor/nodeNestloop.c,v 1.20 2000/08/24 03:29:03 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -88,13 +88,6 @@ ExecNestLoop(NestLoop *node)
econtext->ecxt_outertuple = outerTupleSlot;
/* ----------------
- * Reset per-tuple memory context to free any expression evaluation
- * storage allocated in the previous tuple cycle.
- * ----------------
- */
- ResetExprContext(econtext);
-
- /* ----------------
* Check to see if we're still projecting out tuples from a previous
* join tuple (because there is a function-returning-set in the
* projection expressions). If so, try to project another one.
@@ -103,16 +96,24 @@ ExecNestLoop(NestLoop *node)
if (nlstate->jstate.cs_TupFromTlist)
{
TupleTableSlot *result;
- bool isDone;
+ ExprDoneCond isDone;
result = ExecProject(nlstate->jstate.cs_ProjInfo, &isDone);
- if (!isDone)
+ if (isDone == ExprMultipleResult)
return result;
/* Done with that source tuple... */
nlstate->jstate.cs_TupFromTlist = false;
}
/* ----------------
+ * Reset per-tuple memory context to free any expression evaluation
+ * storage allocated in the previous tuple cycle. Note this can't
+ * happen until we're done projecting out tuples from a join tuple.
+ * ----------------
+ */
+ ResetExprContext(econtext);
+
+ /* ----------------
* Ok, everything is setup for the join so now loop until
* we return a qualifying join tuple..
* ----------------
@@ -219,16 +220,18 @@ ExecNestLoop(NestLoop *node)
* using ExecProject().
* ----------------
*/
- ProjectionInfo *projInfo;
TupleTableSlot *result;
- bool isDone;
+ ExprDoneCond isDone;
ENL1_printf("qualification succeeded, projecting tuple");
- projInfo = nlstate->jstate.cs_ProjInfo;
- result = ExecProject(projInfo, &isDone);
- nlstate->jstate.cs_TupFromTlist = !isDone;
- return result;
+ result = ExecProject(nlstate->jstate.cs_ProjInfo, &isDone);
+
+ if (isDone != ExprEndResult)
+ {
+ nlstate->jstate.cs_TupFromTlist = (isDone == ExprMultipleResult);
+ return result;
+ }
}
/* ----------------