diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-02-15 03:07:21 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-02-15 03:07:21 +0000 |
commit | 9e850cfc7285995e6ce7c030c117dfd800f318c1 (patch) | |
tree | 64f9adcb88998cad745f19972652a32dc20fd8aa /src/backend/executor | |
parent | 538a983237edefe64d071e3a8335719832e37cfa (diff) |
Repair oversight in 8.2 change that improved the handling of "pseudoconstant"
WHERE clauses. createplan.c is now willing to stick a gating Result node
almost anywhere in the plan tree, and in particular one can wind up directly
underneath a MergeJoin node. This means it had better be willing to handle
Mark/Restore. Fortunately, that's trivial in such cases, since we can just
pass off the call to the input node (which the planner has previously ensured
can handle Mark/Restore). Per report from Phil Frost.
Diffstat (limited to 'src/backend/executor')
-rw-r--r-- | src/backend/executor/execAmi.c | 20 | ||||
-rw-r--r-- | src/backend/executor/nodeResult.c | 36 |
2 files changed, 52 insertions, 4 deletions
diff --git a/src/backend/executor/execAmi.c b/src/backend/executor/execAmi.c index 1d5246f9ecd..6a9bd773056 100644 --- a/src/backend/executor/execAmi.c +++ b/src/backend/executor/execAmi.c @@ -6,7 +6,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/backend/executor/execAmi.c,v 1.89 2006/08/02 01:59:45 joe Exp $ + * $PostgreSQL: pgsql/src/backend/executor/execAmi.c,v 1.89.2.1 2007/02/15 03:07:21 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -243,6 +243,10 @@ ExecMarkPos(PlanState *node) ExecSortMarkPos((SortState *) node); break; + case T_ResultState: + ExecResultMarkPos((ResultState *) node); + break; + default: /* don't make hard error unless caller asks to restore... */ elog(DEBUG2, "unrecognized node type: %d", (int) nodeTag(node)); @@ -296,6 +300,10 @@ ExecRestrPos(PlanState *node) ExecSortRestrPos((SortState *) node); break; + case T_ResultState: + ExecResultRestrPos((ResultState *) node); + break; + default: elog(ERROR, "unrecognized node type: %d", (int) nodeTag(node)); break; @@ -328,6 +336,16 @@ ExecSupportsMarkRestore(NodeTag plantype) case T_Sort: return true; + case T_Result: + /* + * T_Result only supports mark/restore if it has a child plan + * that does, so we do not have enough information to give a + * really correct answer. However, for current uses it's + * enough to always say "false", because this routine is not + * asked about gating Result plans, only base-case Results. + */ + return false; + default: break; } diff --git a/src/backend/executor/nodeResult.c b/src/backend/executor/nodeResult.c index a0c18cf3658..c698daa317b 100644 --- a/src/backend/executor/nodeResult.c +++ b/src/backend/executor/nodeResult.c @@ -38,7 +38,7 @@ * Portions Copyright (c) 1994, Regents of the University of California * * IDENTIFICATION - * $PostgreSQL: pgsql/src/backend/executor/nodeResult.c,v 1.34.2.2 2007/02/02 00:07:28 tgl Exp $ + * $PostgreSQL: pgsql/src/backend/executor/nodeResult.c,v 1.34.2.3 2007/02/15 03:07:21 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -167,6 +167,36 @@ ExecResult(ResultState *node) } /* ---------------------------------------------------------------- + * ExecResultMarkPos + * ---------------------------------------------------------------- + */ +void +ExecResultMarkPos(ResultState *node) +{ + PlanState *outerPlan = outerPlanState(node); + + if (outerPlan != NULL) + ExecMarkPos(outerPlan); + else + elog(DEBUG2, "Result nodes do not support mark/restore"); +} + +/* ---------------------------------------------------------------- + * ExecResultRestrPos + * ---------------------------------------------------------------- + */ +void +ExecResultRestrPos(ResultState *node) +{ + PlanState *outerPlan = outerPlanState(node); + + if (outerPlan != NULL) + ExecRestrPos(outerPlan); + else + elog(ERROR, "Result nodes do not support mark/restore"); +} + +/* ---------------------------------------------------------------- * ExecInitResult * * Creates the run-time state information for the result node @@ -180,8 +210,8 @@ ExecInitResult(Result *node, EState *estate, int eflags) ResultState *resstate; /* check for unsupported flags */ - Assert(!(eflags & EXEC_FLAG_MARK)); - Assert(!(eflags & EXEC_FLAG_BACKWARD) || outerPlan(node) != NULL); + Assert(!(eflags & (EXEC_FLAG_MARK | EXEC_FLAG_BACKWARD)) || + outerPlan(node) != NULL); /* * create state structure |