summaryrefslogtreecommitdiff
path: root/src/backend/optimizer/plan/planner.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2001-12-10 22:54:12 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2001-12-10 22:54:12 +0000
commit63cc56de54049e9e2c16dde182fb93c09298af3b (patch)
treeb8a4a4587605e7b7c6d1723c4dd0f1df0facd7a2 /src/backend/optimizer/plan/planner.c
parent584f818bef68450d23d1b75afbaf19febe38fd37 (diff)
Suppress subquery pullup and pushdown when the subquery has any
set-returning functions in its target list. This ensures that we won't rewrite the query in a way that places set-returning functions into quals (WHERE clauses). Cf. bug reports from Joe Conway.
Diffstat (limited to 'src/backend/optimizer/plan/planner.c')
-rw-r--r--src/backend/optimizer/plan/planner.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/backend/optimizer/plan/planner.c b/src/backend/optimizer/plan/planner.c
index 1b71ecbef50..eb92c3d3af9 100644
--- a/src/backend/optimizer/plan/planner.c
+++ b/src/backend/optimizer/plan/planner.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.113 2001/11/05 17:46:26 momjian Exp $
+ * $Header: /cvsroot/pgsql/src/backend/optimizer/plan/planner.c,v 1.114 2001/12/10 22:54:12 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -462,6 +462,15 @@ is_simple_subquery(Query *subquery)
return false;
/*
+ * Don't pull up a subquery that has any set-returning functions in
+ * its targetlist. Otherwise we might well wind up inserting
+ * set-returning functions into places where they mustn't go,
+ * such as quals of higher queries.
+ */
+ if (contain_iter_clause((Node *) subquery->targetList))
+ return false;
+
+ /*
* Hack: don't try to pull up a subquery with an empty jointree.
* query_planner() will correctly generate a Result plan for a
* jointree that's totally empty, but I don't think the right things