diff options
Diffstat (limited to 'src/backend/optimizer/path/allpaths.c')
-rw-r--r-- | src/backend/optimizer/path/allpaths.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c index 782990d0d2a..9368723188f 100644 --- a/src/backend/optimizer/path/allpaths.c +++ b/src/backend/optimizer/path/allpaths.c @@ -8,7 +8,7 @@ * * * IDENTIFICATION - * $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.82 2001/11/05 17:46:25 momjian Exp $ + * $Header: /cvsroot/pgsql/src/backend/optimizer/path/allpaths.c,v 1.83 2001/12/10 22:54:12 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -305,7 +305,14 @@ set_subquery_pathlist(Query *root, RelOptInfo *rel, * checking that seems more work than it's worth. In any case, a * plain DISTINCT is safe to push down past.) * - * 3. We do not push down clauses that contain subselects, mainly because + * 3. If the subquery has any ITER nodes (ie, functions returning sets) + * in its target list, we do not push down any quals, since the quals + * might refer to those tlist items, which would mean we'd introduce + * functions-returning-sets into the subquery's WHERE/HAVING quals. + * (It'd be sufficient to not push down quals that refer to those + * particular tlist items, but that's much clumsier to check.) + * + * 4. We do not push down clauses that contain subselects, mainly because * I'm not sure it will work correctly (the subplan hasn't yet * transformed sublinks to subselects). * @@ -318,7 +325,8 @@ set_subquery_pathlist(Query *root, RelOptInfo *rel, if (subquery->setOperations == NULL && subquery->limitOffset == NULL && subquery->limitCount == NULL && - !has_distinct_on_clause(subquery)) + !has_distinct_on_clause(subquery) && + !contain_iter_clause((Node *) subquery->targetList)) { /* OK to consider pushing down individual quals */ List *upperrestrictlist = NIL; |