diff options
| author | Tom Lane <tgl@sss.pgh.pa.us> | 2010-07-12 17:01:06 +0000 |
|---|---|---|
| committer | Tom Lane <tgl@sss.pgh.pa.us> | 2010-07-12 17:01:06 +0000 |
| commit | 53e757689ce94520f1c53a89dbaa14ea57b09da7 (patch) | |
| tree | afa68ba05699223a719104b953bc20f37d4c33d1 /src/include | |
| parent | 5a3489357fb61f1ea76412ada33549aca152ad55 (diff) | |
| download | postgresql-53e757689ce94520f1c53a89dbaa14ea57b09da7.tar.gz | |
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.
Diffstat (limited to 'src/include')
35 files changed, 101 insertions, 71 deletions
diff --git a/src/include/executor/executor.h b/src/include/executor/executor.h index 119cc2505b..ecaaab5f75 100644 --- a/src/include/executor/executor.h +++ b/src/include/executor/executor.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/executor.h,v 1.169 2010/07/09 14:06:01 rhaas Exp $ + * $PostgreSQL: pgsql/src/include/executor/executor.h,v 1.170 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -82,7 +82,7 @@ extern PGDLLIMPORT ExecutorCheckPerms_hook_type ExecutorCheckPerms_hook; /* * prototypes from functions in execAmi.c */ -extern void ExecReScan(PlanState *node, ExprContext *exprCtxt); +extern void ExecReScan(PlanState *node); extern void ExecMarkPos(PlanState *node); extern void ExecRestrPos(PlanState *node); extern bool ExecSupportsMarkRestore(NodeTag plantype); diff --git a/src/include/executor/nodeAgg.h b/src/include/executor/nodeAgg.h index 67cc71c84b..5e7ab5913b 100644 --- a/src/include/executor/nodeAgg.h +++ b/src/include/executor/nodeAgg.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeAgg.h,v 1.32 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeAgg.h,v 1.33 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -19,7 +19,7 @@ extern AggState *ExecInitAgg(Agg *node, EState *estate, int eflags); extern TupleTableSlot *ExecAgg(AggState *node); extern void ExecEndAgg(AggState *node); -extern void ExecReScanAgg(AggState *node, ExprContext *exprCtxt); +extern void ExecReScanAgg(AggState *node); extern Size hash_agg_entry_size(int numAggs); diff --git a/src/include/executor/nodeAppend.h b/src/include/executor/nodeAppend.h index fbecd82049..9e3f293785 100644 --- a/src/include/executor/nodeAppend.h +++ b/src/include/executor/nodeAppend.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeAppend.h,v 1.30 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeAppend.h,v 1.31 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -19,6 +19,6 @@ extern AppendState *ExecInitAppend(Append *node, EState *estate, int eflags); extern TupleTableSlot *ExecAppend(AppendState *node); extern void ExecEndAppend(AppendState *node); -extern void ExecReScanAppend(AppendState *node, ExprContext *exprCtxt); +extern void ExecReScanAppend(AppendState *node); #endif /* NODEAPPEND_H */ diff --git a/src/include/executor/nodeBitmapAnd.h b/src/include/executor/nodeBitmapAnd.h index 6a8bdf4363..fa09a790fb 100644 --- a/src/include/executor/nodeBitmapAnd.h +++ b/src/include/executor/nodeBitmapAnd.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeBitmapAnd.h,v 1.8 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeBitmapAnd.h,v 1.9 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -19,6 +19,6 @@ extern BitmapAndState *ExecInitBitmapAnd(BitmapAnd *node, EState *estate, int eflags); extern Node *MultiExecBitmapAnd(BitmapAndState *node); extern void ExecEndBitmapAnd(BitmapAndState *node); -extern void ExecReScanBitmapAnd(BitmapAndState *node, ExprContext *exprCtxt); +extern void ExecReScanBitmapAnd(BitmapAndState *node); #endif /* NODEBITMAPAND_H */ diff --git a/src/include/executor/nodeBitmapHeapscan.h b/src/include/executor/nodeBitmapHeapscan.h index 174f60dd0a..472181881f 100644 --- a/src/include/executor/nodeBitmapHeapscan.h +++ b/src/include/executor/nodeBitmapHeapscan.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeBitmapHeapscan.h,v 1.8 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeBitmapHeapscan.h,v 1.9 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -19,6 +19,6 @@ extern BitmapHeapScanState *ExecInitBitmapHeapScan(BitmapHeapScan *node, EState *estate, int eflags); extern TupleTableSlot *ExecBitmapHeapScan(BitmapHeapScanState *node); extern void ExecEndBitmapHeapScan(BitmapHeapScanState *node); -extern void ExecBitmapHeapReScan(BitmapHeapScanState *node, ExprContext *exprCtxt); +extern void ExecReScanBitmapHeapScan(BitmapHeapScanState *node); #endif /* NODEBITMAPHEAPSCAN_H */ diff --git a/src/include/executor/nodeBitmapIndexscan.h b/src/include/executor/nodeBitmapIndexscan.h index 480494be0c..bb4b28cc1a 100644 --- a/src/include/executor/nodeBitmapIndexscan.h +++ b/src/include/executor/nodeBitmapIndexscan.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeBitmapIndexscan.h,v 1.8 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeBitmapIndexscan.h,v 1.9 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -19,6 +19,6 @@ extern BitmapIndexScanState *ExecInitBitmapIndexScan(BitmapIndexScan *node, EState *estate, int eflags); extern Node *MultiExecBitmapIndexScan(BitmapIndexScanState *node); extern void ExecEndBitmapIndexScan(BitmapIndexScanState *node); -extern void ExecBitmapIndexReScan(BitmapIndexScanState *node, ExprContext *exprCtxt); +extern void ExecReScanBitmapIndexScan(BitmapIndexScanState *node); #endif /* NODEBITMAPINDEXSCAN_H */ diff --git a/src/include/executor/nodeBitmapOr.h b/src/include/executor/nodeBitmapOr.h index a9ada8f63f..8987c700c5 100644 --- a/src/include/executor/nodeBitmapOr.h +++ b/src/include/executor/nodeBitmapOr.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeBitmapOr.h,v 1.8 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeBitmapOr.h,v 1.9 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -19,6 +19,6 @@ extern BitmapOrState *ExecInitBitmapOr(BitmapOr *node, EState *estate, int eflags); extern Node *MultiExecBitmapOr(BitmapOrState *node); extern void ExecEndBitmapOr(BitmapOrState *node); -extern void ExecReScanBitmapOr(BitmapOrState *node, ExprContext *exprCtxt); +extern void ExecReScanBitmapOr(BitmapOrState *node); #endif /* NODEBITMAPOR_H */ diff --git a/src/include/executor/nodeCtescan.h b/src/include/executor/nodeCtescan.h index 54008f8b74..22e6dd2152 100644 --- a/src/include/executor/nodeCtescan.h +++ b/src/include/executor/nodeCtescan.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeCtescan.h,v 1.4 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeCtescan.h,v 1.5 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -19,6 +19,6 @@ extern CteScanState *ExecInitCteScan(CteScan *node, EState *estate, int eflags); extern TupleTableSlot *ExecCteScan(CteScanState *node); extern void ExecEndCteScan(CteScanState *node); -extern void ExecCteScanReScan(CteScanState *node, ExprContext *exprCtxt); +extern void ExecReScanCteScan(CteScanState *node); #endif /* NODECTESCAN_H */ diff --git a/src/include/executor/nodeFunctionscan.h b/src/include/executor/nodeFunctionscan.h index 21e868aff6..1584783ed0 100644 --- a/src/include/executor/nodeFunctionscan.h +++ b/src/include/executor/nodeFunctionscan.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeFunctionscan.h,v 1.15 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeFunctionscan.h,v 1.16 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -19,6 +19,6 @@ extern FunctionScanState *ExecInitFunctionScan(FunctionScan *node, EState *estate, int eflags); extern TupleTableSlot *ExecFunctionScan(FunctionScanState *node); extern void ExecEndFunctionScan(FunctionScanState *node); -extern void ExecFunctionReScan(FunctionScanState *node, ExprContext *exprCtxt); +extern void ExecReScanFunctionScan(FunctionScanState *node); #endif /* NODEFUNCTIONSCAN_H */ diff --git a/src/include/executor/nodeGroup.h b/src/include/executor/nodeGroup.h index a7362b2a79..8af917a83f 100644 --- a/src/include/executor/nodeGroup.h +++ b/src/include/executor/nodeGroup.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeGroup.h,v 1.35 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeGroup.h,v 1.36 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -19,6 +19,6 @@ extern GroupState *ExecInitGroup(Group *node, EState *estate, int eflags); extern TupleTableSlot *ExecGroup(GroupState *node); extern void ExecEndGroup(GroupState *node); -extern void ExecReScanGroup(GroupState *node, ExprContext *exprCtxt); +extern void ExecReScanGroup(GroupState *node); #endif /* NODEGROUP_H */ diff --git a/src/include/executor/nodeHash.h b/src/include/executor/nodeHash.h index c5e18a93e7..53348c435f 100644 --- a/src/include/executor/nodeHash.h +++ b/src/include/executor/nodeHash.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeHash.h,v 1.49 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeHash.h,v 1.50 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -20,7 +20,7 @@ extern HashState *ExecInitHash(Hash *node, EState *estate, int eflags); extern TupleTableSlot *ExecHash(HashState *node); extern Node *MultiExecHash(HashState *node); extern void ExecEndHash(HashState *node); -extern void ExecReScanHash(HashState *node, ExprContext *exprCtxt); +extern void ExecReScanHash(HashState *node); extern HashJoinTable ExecHashTableCreate(Hash *node, List *hashOperators); extern void ExecHashTableDestroy(HashJoinTable hashtable); diff --git a/src/include/executor/nodeHashjoin.h b/src/include/executor/nodeHashjoin.h index 462410d95c..0a68e65f51 100644 --- a/src/include/executor/nodeHashjoin.h +++ b/src/include/executor/nodeHashjoin.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeHashjoin.h,v 1.40 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeHashjoin.h,v 1.41 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -20,7 +20,7 @@ extern HashJoinState *ExecInitHashJoin(HashJoin *node, EState *estate, int eflags); extern TupleTableSlot *ExecHashJoin(HashJoinState *node); extern void ExecEndHashJoin(HashJoinState *node); -extern void ExecReScanHashJoin(HashJoinState *node, ExprContext *exprCtxt); +extern void ExecReScanHashJoin(HashJoinState *node); extern void ExecHashJoinSaveTuple(MinimalTuple tuple, uint32 hashvalue, BufFile **fileptr); diff --git a/src/include/executor/nodeIndexscan.h b/src/include/executor/nodeIndexscan.h index 15608cdff8..2a740a4f3e 100644 --- a/src/include/executor/nodeIndexscan.h +++ b/src/include/executor/nodeIndexscan.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeIndexscan.h,v 1.36 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeIndexscan.h,v 1.37 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -21,7 +21,7 @@ extern TupleTableSlot *ExecIndexScan(IndexScanState *node); extern void ExecEndIndexScan(IndexScanState *node); extern void ExecIndexMarkPos(IndexScanState *node); extern void ExecIndexRestrPos(IndexScanState *node); -extern void ExecIndexReScan(IndexScanState *node, ExprContext *exprCtxt); +extern void ExecReScanIndexScan(IndexScanState *node); /* routines exported to share code with nodeBitmapIndexscan.c */ extern void ExecIndexBuildScanKeys(PlanState *planstate, Relation index, diff --git a/src/include/executor/nodeLimit.h b/src/include/executor/nodeLimit.h index 33cd5e298d..1e57eca559 100644 --- a/src/include/executor/nodeLimit.h +++ b/src/include/executor/nodeLimit.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeLimit.h,v 1.18 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeLimit.h,v 1.19 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -19,6 +19,6 @@ extern LimitState *ExecInitLimit(Limit *node, EState *estate, int eflags); extern TupleTableSlot *ExecLimit(LimitState *node); extern void ExecEndLimit(LimitState *node); -extern void ExecReScanLimit(LimitState *node, ExprContext *exprCtxt); +extern void ExecReScanLimit(LimitState *node); #endif /* NODELIMIT_H */ diff --git a/src/include/executor/nodeLockRows.h b/src/include/executor/nodeLockRows.h index c2ea69611e..b3bb3a277c 100644 --- a/src/include/executor/nodeLockRows.h +++ b/src/include/executor/nodeLockRows.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeLockRows.h,v 1.2 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeLockRows.h,v 1.3 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -19,6 +19,6 @@ extern LockRowsState *ExecInitLockRows(LockRows *node, EState *estate, int eflags); extern TupleTableSlot *ExecLockRows(LockRowsState *node); extern void ExecEndLockRows(LockRowsState *node); -extern void ExecReScanLockRows(LockRowsState *node, ExprContext *exprCtxt); +extern void ExecReScanLockRows(LockRowsState *node); #endif /* NODELOCKROWS_H */ diff --git a/src/include/executor/nodeMaterial.h b/src/include/executor/nodeMaterial.h index bc350d1bde..ff1087b0cc 100644 --- a/src/include/executor/nodeMaterial.h +++ b/src/include/executor/nodeMaterial.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeMaterial.h,v 1.30 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeMaterial.h,v 1.31 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -21,6 +21,6 @@ extern TupleTableSlot *ExecMaterial(MaterialState *node); extern void ExecEndMaterial(MaterialState *node); extern void ExecMaterialMarkPos(MaterialState *node); extern void ExecMaterialRestrPos(MaterialState *node); -extern void ExecMaterialReScan(MaterialState *node, ExprContext *exprCtxt); +extern void ExecReScanMaterial(MaterialState *node); #endif /* NODEMATERIAL_H */ diff --git a/src/include/executor/nodeMergejoin.h b/src/include/executor/nodeMergejoin.h index 24b4835ec0..6a176d90f0 100644 --- a/src/include/executor/nodeMergejoin.h +++ b/src/include/executor/nodeMergejoin.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeMergejoin.h,v 1.29 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeMergejoin.h,v 1.30 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -19,6 +19,6 @@ extern MergeJoinState *ExecInitMergeJoin(MergeJoin *node, EState *estate, int eflags); extern TupleTableSlot *ExecMergeJoin(MergeJoinState *node); extern void ExecEndMergeJoin(MergeJoinState *node); -extern void ExecReScanMergeJoin(MergeJoinState *node, ExprContext *exprCtxt); +extern void ExecReScanMergeJoin(MergeJoinState *node); #endif /* NODEMERGEJOIN_H */ diff --git a/src/include/executor/nodeModifyTable.h b/src/include/executor/nodeModifyTable.h index a503581943..373ae1c13f 100644 --- a/src/include/executor/nodeModifyTable.h +++ b/src/include/executor/nodeModifyTable.h @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeModifyTable.h,v 1.2 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeModifyTable.h,v 1.3 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -18,6 +18,6 @@ extern ModifyTableState *ExecInitModifyTable(ModifyTable *node, EState *estate, int eflags); extern TupleTableSlot *ExecModifyTable(ModifyTableState *node); extern void ExecEndModifyTable(ModifyTableState *node); -extern void ExecReScanModifyTable(ModifyTableState *node, ExprContext *exprCtxt); +extern void ExecReScanModifyTable(ModifyTableState *node); #endif /* NODEMODIFYTABLE_H */ diff --git a/src/include/executor/nodeNestloop.h b/src/include/executor/nodeNestloop.h index ce960de8f2..01e22b6082 100644 --- a/src/include/executor/nodeNestloop.h +++ b/src/include/executor/nodeNestloop.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeNestloop.h,v 1.30 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeNestloop.h,v 1.31 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -19,6 +19,6 @@ extern NestLoopState *ExecInitNestLoop(NestLoop *node, EState *estate, int eflags); extern TupleTableSlot *ExecNestLoop(NestLoopState *node); extern void ExecEndNestLoop(NestLoopState *node); -extern void ExecReScanNestLoop(NestLoopState *node, ExprContext *exprCtxt); +extern void ExecReScanNestLoop(NestLoopState *node); #endif /* NODENESTLOOP_H */ diff --git a/src/include/executor/nodeRecursiveunion.h b/src/include/executor/nodeRecursiveunion.h index 8d8c99b0e6..87d9888f86 100644 --- a/src/include/executor/nodeRecursiveunion.h +++ b/src/include/executor/nodeRecursiveunion.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeRecursiveunion.h,v 1.4 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeRecursiveunion.h,v 1.5 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -19,6 +19,6 @@ extern RecursiveUnionState *ExecInitRecursiveUnion(RecursiveUnion *node, EState *estate, int eflags); extern TupleTableSlot *ExecRecursiveUnion(RecursiveUnionState *node); extern void ExecEndRecursiveUnion(RecursiveUnionState *node); -extern void ExecRecursiveUnionReScan(RecursiveUnionState *node, ExprContext *exprCtxt); +extern void ExecReScanRecursiveUnion(RecursiveUnionState *node); #endif /* NODERECURSIVEUNION_H */ diff --git a/src/include/executor/nodeResult.h b/src/include/executor/nodeResult.h index 89085e8945..4c6234d688 100644 --- a/src/include/executor/nodeResult.h +++ b/src/include/executor/nodeResult.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeResult.h,v 1.28 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeResult.h,v 1.29 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -21,6 +21,6 @@ extern TupleTableSlot *ExecResult(ResultState *node); extern void ExecEndResult(ResultState *node); extern void ExecResultMarkPos(ResultState *node); extern void ExecResultRestrPos(ResultState *node); -extern void ExecReScanResult(ResultState *node, ExprContext *exprCtxt); +extern void ExecReScanResult(ResultState *node); #endif /* NODERESULT_H */ diff --git a/src/include/executor/nodeSeqscan.h b/src/include/executor/nodeSeqscan.h index 6184c3edcd..334fd44920 100644 --- a/src/include/executor/nodeSeqscan.h +++ b/src/include/executor/nodeSeqscan.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeSeqscan.h,v 1.29 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeSeqscan.h,v 1.30 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -21,6 +21,6 @@ extern TupleTableSlot *ExecSeqScan(SeqScanState *node); extern void ExecEndSeqScan(SeqScanState *node); extern void ExecSeqMarkPos(SeqScanState *node); extern void ExecSeqRestrPos(SeqScanState *node); -extern void ExecSeqReScan(SeqScanState *node, ExprContext *exprCtxt); +extern void ExecReScanSeqScan(SeqScanState *node); #endif /* NODESEQSCAN_H */ diff --git a/src/include/executor/nodeSetOp.h b/src/include/executor/nodeSetOp.h index 791b6595aa..cdb0579afd 100644 --- a/src/include/executor/nodeSetOp.h +++ b/src/include/executor/nodeSetOp.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeSetOp.h,v 1.18 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeSetOp.h,v 1.19 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -19,6 +19,6 @@ extern SetOpState *ExecInitSetOp(SetOp *node, EState *estate, int eflags); extern TupleTableSlot *ExecSetOp(SetOpState *node); extern void ExecEndSetOp(SetOpState *node); -extern void ExecReScanSetOp(SetOpState *node, ExprContext *exprCtxt); +extern void ExecReScanSetOp(SetOpState *node); #endif /* NODESETOP_H */ diff --git a/src/include/executor/nodeSort.h b/src/include/executor/nodeSort.h index d5a87e8923..ee63274af2 100644 --- a/src/include/executor/nodeSort.h +++ b/src/include/executor/nodeSort.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeSort.h,v 1.27 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeSort.h,v 1.28 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -21,6 +21,6 @@ extern TupleTableSlot *ExecSort(SortState *node); extern void ExecEndSort(SortState *node); extern void ExecSortMarkPos(SortState *node); extern void ExecSortRestrPos(SortState *node); -extern void ExecReScanSort(SortState *node, ExprContext *exprCtxt); +extern void ExecReScanSort(SortState *node); #endif /* NODESORT_H */ diff --git a/src/include/executor/nodeSubqueryscan.h b/src/include/executor/nodeSubqueryscan.h index 387a12b045..1139ce3f3e 100644 --- a/src/include/executor/nodeSubqueryscan.h +++ b/src/include/executor/nodeSubqueryscan.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeSubqueryscan.h,v 1.18 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeSubqueryscan.h,v 1.19 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -19,6 +19,6 @@ extern SubqueryScanState *ExecInitSubqueryScan(SubqueryScan *node, EState *estate, int eflags); extern TupleTableSlot *ExecSubqueryScan(SubqueryScanState *node); extern void ExecEndSubqueryScan(SubqueryScanState *node); -extern void ExecSubqueryReScan(SubqueryScanState *node, ExprContext *exprCtxt); +extern void ExecReScanSubqueryScan(SubqueryScanState *node); #endif /* NODESUBQUERYSCAN_H */ diff --git a/src/include/executor/nodeTidscan.h b/src/include/executor/nodeTidscan.h index 1bbbb1e52f..45b9b814cb 100644 --- a/src/include/executor/nodeTidscan.h +++ b/src/include/executor/nodeTidscan.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeTidscan.h,v 1.22 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeTidscan.h,v 1.23 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -21,6 +21,6 @@ extern TupleTableSlot *ExecTidScan(TidScanState *node); extern void ExecEndTidScan(TidScanState *node); extern void ExecTidMarkPos(TidScanState *node); extern void ExecTidRestrPos(TidScanState *node); -extern void ExecTidReScan(TidScanState *node, ExprContext *exprCtxt); +extern void ExecReScanTidScan(TidScanState *node); #endif /* NODETIDSCAN_H */ diff --git a/src/include/executor/nodeUnique.h b/src/include/executor/nodeUnique.h index 4fd4d92d4d..1c57a23fb1 100644 --- a/src/include/executor/nodeUnique.h +++ b/src/include/executor/nodeUnique.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeUnique.h,v 1.27 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeUnique.h,v 1.28 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -19,6 +19,6 @@ extern UniqueState *ExecInitUnique(Unique *node, EState *estate, int eflags); extern TupleTableSlot *ExecUnique(UniqueState *node); extern void ExecEndUnique(UniqueState *node); -extern void ExecReScanUnique(UniqueState *node, ExprContext *exprCtxt); +extern void ExecReScanUnique(UniqueState *node); #endif /* NODEUNIQUE_H */ diff --git a/src/include/executor/nodeValuesscan.h b/src/include/executor/nodeValuesscan.h index 81b2f4108d..049d66923a 100644 --- a/src/include/executor/nodeValuesscan.h +++ b/src/include/executor/nodeValuesscan.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeValuesscan.h,v 1.7 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeValuesscan.h,v 1.8 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -21,6 +21,6 @@ extern TupleTableSlot *ExecValuesScan(ValuesScanState *node); extern void ExecEndValuesScan(ValuesScanState *node); extern void ExecValuesMarkPos(ValuesScanState *node); extern void ExecValuesRestrPos(ValuesScanState *node); -extern void ExecValuesReScan(ValuesScanState *node, ExprContext *exprCtxt); +extern void ExecReScanValuesScan(ValuesScanState *node); #endif /* NODEVALUESSCAN_H */ diff --git a/src/include/executor/nodeWindowAgg.h b/src/include/executor/nodeWindowAgg.h index 759120a7e7..5e944e45a8 100644 --- a/src/include/executor/nodeWindowAgg.h +++ b/src/include/executor/nodeWindowAgg.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeWindowAgg.h,v 1.4 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeWindowAgg.h,v 1.5 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -19,6 +19,6 @@ extern WindowAggState *ExecInitWindowAgg(WindowAgg *node, EState *estate, int eflags); extern TupleTableSlot *ExecWindowAgg(WindowAggState *node); extern void ExecEndWindowAgg(WindowAggState *node); -extern void ExecReScanWindowAgg(WindowAggState *node, ExprContext *exprCtxt); +extern void ExecReScanWindowAgg(WindowAggState *node); #endif /* NODEWINDOWAGG_H */ diff --git a/src/include/executor/nodeWorktablescan.h b/src/include/executor/nodeWorktablescan.h index cda6d0a91e..53e465ce33 100644 --- a/src/include/executor/nodeWorktablescan.h +++ b/src/include/executor/nodeWorktablescan.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/executor/nodeWorktablescan.h,v 1.4 2010/01/02 16:58:03 momjian Exp $ + * $PostgreSQL: pgsql/src/include/executor/nodeWorktablescan.h,v 1.5 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -19,6 +19,6 @@ extern WorkTableScanState *ExecInitWorkTableScan(WorkTableScan *node, EState *estate, int eflags); extern TupleTableSlot *ExecWorkTableScan(WorkTableScanState *node); extern void ExecEndWorkTableScan(WorkTableScanState *node); -extern void ExecWorkTableScanReScan(WorkTableScanState *node, ExprContext *exprCtxt); +extern void ExecReScanWorkTableScan(WorkTableScanState *node); #endif /* NODEWORKTABLESCAN_H */ diff --git a/src/include/nodes/nodes.h b/src/include/nodes/nodes.h index 401b69e088..24ddb3f0d3 100644 --- a/src/include/nodes/nodes.h +++ b/src/include/nodes/nodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/nodes.h,v 1.234 2010/03/28 22:59:33 tgl Exp $ + * $PostgreSQL: pgsql/src/include/nodes/nodes.h,v 1.235 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -74,6 +74,7 @@ typedef enum NodeTag T_LockRows, T_Limit, /* these aren't subclasses of Plan: */ + T_NestLoopParam, T_PlanRowMark, T_PlanInvalItem, diff --git a/src/include/nodes/plannodes.h b/src/include/nodes/plannodes.h index 79876100d5..5ca1b0f8fb 100644 --- a/src/include/nodes/plannodes.h +++ b/src/include/nodes/plannodes.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/plannodes.h,v 1.117 2010/02/26 02:01:25 momjian Exp $ + * $PostgreSQL: pgsql/src/include/nodes/plannodes.h,v 1.118 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -432,13 +432,26 @@ typedef struct Join /* ---------------- * nest loop join node + * + * The nestParams list identifies any executor Params that must be passed + * into execution of the inner subplan carrying values from the current row + * of the outer subplan. Currently we restrict these values to be simple + * Vars, but perhaps someday that'd be worth relaxing. * ---------------- */ typedef struct NestLoop { Join join; + List *nestParams; /* list of NestLoopParam nodes */ } NestLoop; +typedef struct NestLoopParam +{ + NodeTag type; + int paramno; /* number of the PARAM_EXEC Param to set */ + Var *paramval; /* outer-relation Var to assign to Param */ +} NestLoopParam; + /* ---------------- * merge join node * diff --git a/src/include/nodes/primnodes.h b/src/include/nodes/primnodes.h index 3fc3d3483b..484eb0d627 100644 --- a/src/include/nodes/primnodes.h +++ b/src/include/nodes/primnodes.h @@ -10,7 +10,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/primnodes.h,v 1.156 2010/02/26 02:01:25 momjian Exp $ + * $PostgreSQL: pgsql/src/include/nodes/primnodes.h,v 1.157 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -175,7 +175,8 @@ typedef struct Const * Such parameters are numbered from 1 to n. * * PARAM_EXEC: The parameter is an internal executor parameter, used - * for passing values into and out of sub-queries. + * for passing values into and out of sub-queries or from + * nestloop joins to their inner scans. * For historical reasons, such parameters are numbered from 0. * These numbers are independent of PARAM_EXTERN numbers. * diff --git a/src/include/nodes/relation.h b/src/include/nodes/relation.h index a684f19222..3374e5fae7 100644 --- a/src/include/nodes/relation.h +++ b/src/include/nodes/relation.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.187 2010/07/06 19:19:00 momjian Exp $ + * $PostgreSQL: pgsql/src/include/nodes/relation.h,v 1.188 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -209,6 +209,10 @@ typedef struct PlannerInfo int wt_param_id; /* PARAM_EXEC ID for the work table */ struct Plan *non_recursive_plan; /* plan for non-recursive term */ + /* These fields are workspace for createplan.c */ + Relids curOuterRels; /* outer rels above current node */ + List *curOuterParams; /* not-yet-assigned NestLoopParams */ + /* optional private data for join_search_hook, e.g., GEQO */ void *join_search_private; } PlannerInfo; @@ -1330,16 +1334,20 @@ typedef struct PlaceHolderInfo /* * glob->paramlist keeps track of the PARAM_EXEC slots that we have decided * we need for the query. At runtime these slots are used to pass values - * either down into subqueries (for outer references in subqueries) or up out - * of subqueries (for the results of a subplan). The n'th entry in the list - * (n counts from 0) corresponds to Param->paramid = n. + * around from one plan node to another. They can be used to pass values + * down into subqueries (for outer references in subqueries), or up out of + * subqueries (for the results of a subplan), or from a NestLoop plan node + * into its inner relation (when the inner scan is parameterized with values + * from the outer relation). The n'th entry in the list (n counts from 0) + * corresponds to Param->paramid = n. * * Each paramlist item shows the absolute query level it is associated with, * where the outermost query is level 1 and nested subqueries have higher * numbers. The item the parameter slot represents can be one of three kinds: * * A Var: the slot represents a variable of that level that must be passed - * down because subqueries have outer references to it. The varlevelsup + * down because subqueries have outer references to it, or must be passed + * from a NestLoop node of that level to its inner scan. The varlevelsup * value in the Var will always be zero. * * An Aggref (with an expression tree representing its argument): the slot @@ -1352,7 +1360,13 @@ typedef struct PlaceHolderInfo * to the parent query of the subplan. * * Note: we detect duplicate Var parameters and coalesce them into one slot, - * but we do not do this for Aggref or Param slots. + * but we do not bother to do this for Aggrefs, and it would be incorrect + * to do so for Param slots. Duplicate detection is actually *necessary* + * in the case of NestLoop parameters since it serves to match up the usage + * of a Param (in the inner scan) with the assignment of the value (in the + * NestLoop node). This might result in the same PARAM_EXEC slot being used + * by multiple NestLoop nodes or SubPlan nodes, but no harm is done since + * the same value would be assigned anyway. */ typedef struct PlannerParamItem { diff --git a/src/include/optimizer/subselect.h b/src/include/optimizer/subselect.h index 1bc52cc14c..abbbd58c24 100644 --- a/src/include/optimizer/subselect.h +++ b/src/include/optimizer/subselect.h @@ -5,7 +5,7 @@ * Portions Copyright (c) 1996-2010, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/optimizer/subselect.h,v 1.39 2010/01/02 16:58:07 momjian Exp $ + * $PostgreSQL: pgsql/src/include/optimizer/subselect.h,v 1.40 2010/07/12 17:01:06 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -29,6 +29,7 @@ extern void SS_finalize_plan(PlannerInfo *root, Plan *plan, bool attach_initplans); extern Param *SS_make_initplan_from_plan(PlannerInfo *root, Plan *plan, Oid resulttype, int32 resulttypmod); +extern Param *assign_nestloop_param(PlannerInfo *root, Var *var); extern int SS_assign_special_param(PlannerInfo *root); #endif /* SUBSELECT_H */ |
