From 782c16c6a154e760bf1608d633488538cd52da93 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Thu, 24 Aug 2000 03:29:15 +0000 Subject: 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. --- src/backend/executor/nodeHashjoin.c | 33 +++++++++++++++++---------------- 1 file changed, 17 insertions(+), 16 deletions(-) (limited to 'src/backend/executor/nodeHashjoin.c') diff --git a/src/backend/executor/nodeHashjoin.c b/src/backend/executor/nodeHashjoin.c index 54af882db12..4b3b4a82505 100644 --- a/src/backend/executor/nodeHashjoin.c +++ b/src/backend/executor/nodeHashjoin.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.32 2000/07/17 03:04:53 tgl Exp $ + * $Header: /cvsroot/pgsql/src/backend/executor/nodeHashjoin.c,v 1.33 2000/08/24 03:29:03 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -55,6 +55,7 @@ ExecHashJoin(HashJoin *node) TupleTableSlot *inntuple; Node *outerVar; ExprContext *econtext; + ExprDoneCond isDone; HashJoinTable hashtable; HeapTuple curtuple; TupleTableSlot *outerTupleSlot; @@ -83,13 +84,6 @@ ExecHashJoin(HashJoin *node) hashtable = hjstate->hj_HashTable; econtext = hjstate->jstate.cs_ExprContext; - /* ---------------- - * 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 @@ -99,15 +93,22 @@ ExecHashJoin(HashJoin *node) if (hjstate->jstate.cs_TupFromTlist) { TupleTableSlot *result; - bool isDone; result = ExecProject(hjstate->jstate.cs_ProjInfo, &isDone); - if (!isDone) + if (isDone == ExprMultipleResult) return result; /* Done with that source tuple... */ hjstate->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); + /* ---------------- * if this is the first call, build the hash table for inner relation * ---------------- @@ -241,15 +242,15 @@ ExecHashJoin(HashJoin *node) */ if (ExecQual(qual, econtext, false)) { - ProjectionInfo *projInfo; TupleTableSlot *result; - bool isDone; hjstate->jstate.cs_OuterTupleSlot = outerTupleSlot; - projInfo = hjstate->jstate.cs_ProjInfo; - result = ExecProject(projInfo, &isDone); - hjstate->jstate.cs_TupFromTlist = !isDone; - return result; + result = ExecProject(hjstate->jstate.cs_ProjInfo, &isDone); + if (isDone != ExprEndResult) + { + hjstate->jstate.cs_TupFromTlist = (isDone == ExprMultipleResult); + return result; + } } } -- cgit v1.2.3