mirror of
https://github.com/postgres/postgres.git
synced 2025-07-12 21:01:52 +03:00
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.
This commit is contained in:
@ -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 $
|
||||
*
|
||||
*-------------------------------------------------------------------------
|
||||
*/
|
||||
@ -461,6 +461,15 @@ is_simple_subquery(Query *subquery)
|
||||
subquery->limitCount)
|
||||
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
|
||||
|
Reference in New Issue
Block a user