summaryrefslogtreecommitdiff
path: root/src/backend/executor/execAmi.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2009-10-12 18:10:51 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2009-10-12 18:10:51 +0000
commit0adaf4cb312fe3eff83e786d6a0b53ae2cdc9302 (patch)
tree177cf2ea668d6fcabbafc37db4741813ea3f685d /src/backend/executor/execAmi.c
parent05d249717d652f0b16960d8a58611e222f1f907b (diff)
downloadpostgresql-0adaf4cb312fe3eff83e786d6a0b53ae2cdc9302.tar.gz
Move the handling of SELECT FOR UPDATE locking and rechecking out of
execMain.c and into a new plan node type LockRows. Like the recent change to put table updating into a ModifyTable plan node, this increases planning flexibility by allowing the operations to occur below the top level of the plan tree. It's necessary in any case to restore the previous behavior of having FOR UPDATE locking occur before ModifyTable does. This partially refactors EvalPlanQual to allow multiple rows-under-test to be inserted into the EPQ machinery before starting an EPQ test query. That isn't sufficient to fix EPQ's general bogosity in the face of plans that return multiple rows per test row, though. Since this patch is mostly about getting some plan node infrastructure in place and not about fixing ten-year-old bugs, I will leave EPQ improvements for another day. Another behavioral change that we could now think about is doing FOR UPDATE before LIMIT, but that too seems like it should be treated as a followon patch.
Diffstat (limited to 'src/backend/executor/execAmi.c')
-rw-r--r--src/backend/executor/execAmi.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/backend/executor/execAmi.c b/src/backend/executor/execAmi.c
index 6c2de387ef..ee929299ad 100644
--- a/src/backend/executor/execAmi.c
+++ b/src/backend/executor/execAmi.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2009, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/executor/execAmi.c,v 1.105 2009/10/10 01:43:45 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/execAmi.c,v 1.106 2009/10/12 18:10:41 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -28,6 +28,7 @@
#include "executor/nodeHashjoin.h"
#include "executor/nodeIndexscan.h"
#include "executor/nodeLimit.h"
+#include "executor/nodeLockRows.h"
#include "executor/nodeMaterial.h"
#include "executor/nodeMergejoin.h"
#include "executor/nodeModifyTable.h"
@@ -232,6 +233,10 @@ ExecReScan(PlanState *node, ExprContext *exprCtxt)
ExecReScanSetOp((SetOpState *) node, exprCtxt);
break;
+ case T_LockRowsState:
+ ExecReScanLockRows((LockRowsState *) node, exprCtxt);
+ break;
+
case T_LimitState:
ExecReScanLimit((LimitState *) node, exprCtxt);
break;
@@ -444,8 +449,9 @@ ExecSupportsBackwardScan(Plan *node)
/* these don't evaluate tlist */
return true;
+ case T_LockRows:
case T_Limit:
- /* doesn't evaluate tlist */
+ /* these don't evaluate tlist */
return ExecSupportsBackwardScan(outerPlan(node));
default: