diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2007-10-04 20:44:55 +0000 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2007-10-04 20:44:55 +0000 |
commit | 0969e9cc0e47c141a0075cdbc2a0369113d206db (patch) | |
tree | abeea0ff19ce32a6141ab1945829024b422f57f9 /src/include/optimizer/planmain.h | |
parent | f3c6d3daf901b69226fa7c930d655bc5ce6adca0 (diff) | |
download | postgresql-0969e9cc0e47c141a0075cdbc2a0369113d206db.tar.gz postgresql-0969e9cc0e47c141a0075cdbc2a0369113d206db.zip |
Keep the planner from failing on "WHERE false AND something IN (SELECT ...)".
eval_const_expressions simplifies this to just "WHERE false", but we have
already done pull_up_IN_clauses so the IN join will be done, or at least
planned, anyway. The trouble case comes when the sub-SELECT is itself a join
and we decide to implement the IN by unique-ifying the sub-SELECT outputs:
with no remaining reference to the output Vars in WHERE, we won't have
propagated the Vars up to the upper join point, leading to "variable not found
in subplan target lists" error. Fix by adding an extra scan of in_info_list
and forcing all Vars mentioned therein to be propagated up to the IN join
point. Per bug report from Miroslav Sulc.
Diffstat (limited to 'src/include/optimizer/planmain.h')
-rw-r--r-- | src/include/optimizer/planmain.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/src/include/optimizer/planmain.h b/src/include/optimizer/planmain.h index c4c9389af9d..24dd1840683 100644 --- a/src/include/optimizer/planmain.h +++ b/src/include/optimizer/planmain.h @@ -7,7 +7,7 @@ * Portions Copyright (c) 1996-2006, PostgreSQL Global Development Group * Portions Copyright (c) 1994, Regents of the University of California * - * $PostgreSQL: pgsql/src/include/optimizer/planmain.h,v 1.95 2006/08/12 02:52:06 tgl Exp $ + * $PostgreSQL: pgsql/src/include/optimizer/planmain.h,v 1.95.2.1 2007/10/04 20:44:55 tgl Exp $ * *------------------------------------------------------------------------- */ @@ -69,6 +69,7 @@ extern int join_collapse_limit; extern void add_base_rels_to_query(PlannerInfo *root, Node *jtnode); extern void build_base_rel_tlists(PlannerInfo *root, List *final_tlist); +extern void add_IN_vars_to_tlists(PlannerInfo *root); extern List *deconstruct_jointree(PlannerInfo *root); extern void process_implied_equality(PlannerInfo *root, Node *item1, Node *item2, |