diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2000-08-24 03:29:15 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2000-08-24 03:29:15 +0000 |
commit | 782c16c6a154e760bf1608d633488538cd52da93 (patch) | |
tree | 902da787593da21a979bd2f74b0b44acf9c427b0 /src/backend/executor/nodeMergejoin.c | |
parent | 87523ab8db34859ae3fb980a3fab9f29dfc4c97a (diff) | |
download | postgresql-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/nodeMergejoin.c')
-rw-r--r-- | src/backend/executor/nodeMergejoin.c | 41 |
1 files changed, 21 insertions, 20 deletions
diff --git a/src/backend/executor/nodeMergejoin.c b/src/backend/executor/nodeMergejoin.c index a3f92b06901..5a2f45028a0 100644 --- a/src/backend/executor/nodeMergejoin.c +++ b/src/backend/executor/nodeMergejoin.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.36 2000/07/12 02:37:03 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/nodeMergejoin.c,v 1.37 2000/08/24 03:29:03 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -226,18 +226,16 @@ MergeCompare(List *eqQual, List *compareQual, ExprContext *econtext) { Datum const_value; bool isNull; - bool isDone; /* ---------------- * first test if our compare clause is satisfied. * if so then return true. * * A NULL result is considered false. - * ignore isDone, don't iterate in quals. * ---------------- */ const_value = ExecEvalExpr((Node *) lfirst(clause), econtext, - &isNull, &isDone); + &isNull, NULL); if (DatumGetBool(const_value) && !isNull) { @@ -254,7 +252,7 @@ MergeCompare(List *eqQual, List *compareQual, ExprContext *econtext) const_value = ExecEvalExpr((Node *) lfirst(eqclause), econtext, &isNull, - &isDone); + NULL); if (! DatumGetBool(const_value) || isNull) break; /* return false */ @@ -448,13 +446,6 @@ ExecMergeJoin(MergeJoin *node) } /* ---------------- - * 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. @@ -463,16 +454,24 @@ ExecMergeJoin(MergeJoin *node) if (mergestate->jstate.cs_TupFromTlist) { TupleTableSlot *result; - bool isDone; + ExprDoneCond isDone; result = ExecProject(mergestate->jstate.cs_ProjInfo, &isDone); - if (!isDone) + if (isDone == ExprMultipleResult) return result; /* Done with that source tuple... */ mergestate->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.. let's go to work * ---------------- */ @@ -599,17 +598,19 @@ ExecMergeJoin(MergeJoin *node) * projection tuple and return the slot containing it. * ---------------- */ - ProjectionInfo *projInfo; TupleTableSlot *result; - bool isDone; + ExprDoneCond isDone; MJ_printf("ExecMergeJoin: **** returning tuple ****\n"); - projInfo = mergestate->jstate.cs_ProjInfo; + result = ExecProject(mergestate->jstate.cs_ProjInfo, + &isDone); - result = ExecProject(projInfo, &isDone); - mergestate->jstate.cs_TupFromTlist = !isDone; - return result; + if (isDone != ExprEndResult) + { + mergestate->jstate.cs_TupFromTlist = (isDone == ExprMultipleResult); + return result; + } } break; |