aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/backend/executor/execAmi.c3
-rw-r--r--src/backend/executor/nodeWorktablescan.c19
2 files changed, 13 insertions, 9 deletions
diff --git a/src/backend/executor/execAmi.c b/src/backend/executor/execAmi.c
index 9b2e32576e1..ef4f6853899 100644
--- a/src/backend/executor/execAmi.c
+++ b/src/backend/executor/execAmi.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2008, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/executor/execAmi.c,v 1.100 2008/10/17 22:10:29 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/execAmi.c,v 1.101 2008/10/28 17:13:51 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -419,7 +419,6 @@ ExecSupportsBackwardScan(Plan *node)
case T_FunctionScan:
case T_ValuesScan:
case T_CteScan:
- case T_WorkTableScan:
return TargetListSupportsBackwardScan(node->targetlist);
case T_IndexScan:
diff --git a/src/backend/executor/nodeWorktablescan.c b/src/backend/executor/nodeWorktablescan.c
index 49b7279aba8..47f6e202ec1 100644
--- a/src/backend/executor/nodeWorktablescan.c
+++ b/src/backend/executor/nodeWorktablescan.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/executor/nodeWorktablescan.c,v 1.3 2008/10/23 15:29:23 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/executor/nodeWorktablescan.c,v 1.4 2008/10/28 17:13:51 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -31,14 +31,21 @@ WorkTableScanNext(WorkTableScanState *node)
{
TupleTableSlot *slot;
EState *estate;
- ScanDirection direction;
Tuplestorestate *tuplestorestate;
/*
* get information from the estate and scan state
+ *
+ * Note: we intentionally do not support backward scan. Although it would
+ * take only a couple more lines here, it would force nodeRecursiveunion.c
+ * to create the tuplestore with backward scan enabled, which has a
+ * performance cost. In practice backward scan is never useful for a
+ * worktable plan node, since it cannot appear high enough in the plan
+ * tree of a scrollable cursor to be exposed to a backward-scan
+ * requirement. So it's not worth expending effort to support it.
*/
estate = node->ss.ps.state;
- direction = estate->es_direction;
+ Assert(ScanDirectionIsForward(estate->es_direction));
tuplestorestate = node->rustate->working_table;
@@ -46,9 +53,7 @@ WorkTableScanNext(WorkTableScanState *node)
* Get the next tuple from tuplestore. Return NULL if no more tuples.
*/
slot = node->ss.ss_ScanTupleSlot;
- (void) tuplestore_gettupleslot(tuplestorestate,
- ScanDirectionIsForward(direction),
- slot);
+ (void) tuplestore_gettupleslot(tuplestorestate, true, slot);
return slot;
}
@@ -114,7 +119,7 @@ ExecInitWorkTableScan(WorkTableScan *node, EState *estate, int eflags)
WorkTableScanState *scanstate;
/* check for unsupported flags */
- Assert(!(eflags & EXEC_FLAG_MARK));
+ Assert(!(eflags & (EXEC_FLAG_BACKWARD | EXEC_FLAG_MARK)));
/*
* WorkTableScan should not have any children.