pgsql: Keep the planner from failing on "WHERE false AND something IN

From: tgl(at)postgresql(dot)org (Tom Lane)
To: pgsql-committers(at)postgresql(dot)org
Subject: pgsql: Keep the planner from failing on "WHERE false AND something IN
Date: 2007-10-04 20:44:55
Message-ID: 20071004204455.37E11753E4C@cvs.postgresql.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-committers

Log Message:
-----------
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.

Tags:
----
REL8_2_STABLE

Modified Files:
--------------
pgsql/src/backend/optimizer/plan:
initsplan.c (r1.123.2.6 -> r1.123.2.7)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/initsplan.c?r1=1.123.2.6&r2=1.123.2.7)
planmain.c (r1.97 -> r1.97.2.1)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/backend/optimizer/plan/planmain.c?r1=1.97&r2=1.97.2.1)
pgsql/src/include/optimizer:
planmain.h (r1.95 -> r1.95.2.1)
(http://developer.postgresql.org/cvsweb.cgi/pgsql/src/include/optimizer/planmain.h?r1=1.95&r2=1.95.2.1)

Browse pgsql-committers by date

  From Date Subject
Next Message Tom Lane 2007-10-04 20:45:02 pgsql: Keep the planner from failing on "WHERE false AND something IN
Previous Message Tom Lane 2007-10-04 20:44:47 pgsql: Keep the planner from failing on "WHERE false AND something IN