From 53e757689ce94520f1c53a89dbaa14ea57b09da7 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Mon, 12 Jul 2010 17:01:06 +0000 Subject: Make NestLoop plan nodes pass outer-relation variables into their inner relation using the general PARAM_EXEC executor parameter mechanism, rather than the ad-hoc kluge of passing the outer tuple down through ExecReScan. The previous method was hard to understand and could never be extended to handle parameters coming from multiple join levels. This patch doesn't change the set of possible plans nor have any significant performance effect, but it's necessary infrastructure for future generalization of the concept of an inner indexscan plan. ExecReScan's second parameter is now unused, so it's removed. --- src/backend/nodes/outfuncs.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) (limited to 'src/backend/nodes/outfuncs.c') diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index dba8d4b6690..ff4a9aaeefd 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.385 2010/03/30 21:58:10 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/nodes/outfuncs.c,v 1.386 2010/07/12 17:01:05 tgl Exp $ * * NOTES * Every node type that can appear in stored rules' parsetrees *must* @@ -517,6 +517,8 @@ _outNestLoop(StringInfo str, NestLoop *node) WRITE_NODE_TYPE("NESTLOOP"); _outJoinPlanInfo(str, (Join *) node); + + WRITE_NODE_FIELD(nestParams); } static void @@ -748,6 +750,15 @@ _outLimit(StringInfo str, Limit *node) WRITE_NODE_FIELD(limitCount); } +static void +_outNestLoopParam(StringInfo str, NestLoopParam *node) +{ + WRITE_NODE_TYPE("NESTLOOPPARAM"); + + WRITE_INT_FIELD(paramno); + WRITE_NODE_FIELD(paramval); +} + static void _outPlanRowMark(StringInfo str, PlanRowMark *node) { @@ -1565,6 +1576,8 @@ _outPlannerInfo(StringInfo str, PlannerInfo *node) WRITE_BOOL_FIELD(hasPseudoConstantQuals); WRITE_BOOL_FIELD(hasRecursion); WRITE_INT_FIELD(wt_param_id); + WRITE_BITMAPSET_FIELD(curOuterRels); + WRITE_NODE_FIELD(curOuterParams); } static void @@ -2562,6 +2575,9 @@ _outNode(StringInfo str, void *obj) case T_Limit: _outLimit(str, obj); break; + case T_NestLoopParam: + _outNestLoopParam(str, obj); + break; case T_PlanRowMark: _outPlanRowMark(str, obj); break; -- cgit v1.2.3