summaryrefslogtreecommitdiff
path: root/src/backend/optimizer/path/allpaths.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/optimizer/path/allpaths.c')
-rw-r--r--src/backend/optimizer/path/allpaths.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c
index 8187ab37d5b..94c8b6cba6a 100644
--- a/src/backend/optimizer/path/allpaths.c
+++ b/src/backend/optimizer/path/allpaths.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.168.2.3 2008/11/11 18:13:43 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/path/allpaths.c,v 1.168.2.4 2009/03/10 20:58:41 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -478,6 +478,13 @@ set_subquery_pathlist(PlannerInfo *root, RelOptInfo *rel,
PlannerInfo *subroot;
List *pathkeys;
+ /*
+ * Must copy the Query so that planning doesn't mess up the RTE contents
+ * (really really need to fix the planner to not scribble on its input,
+ * someday).
+ */
+ subquery = copyObject(subquery);
+
/* We need a workspace for keeping track of set-op type coercions */
differentTypes = (bool *)
palloc0((list_length(subquery->targetList) + 1) * sizeof(bool));