Fix set_append_rel_pathlist() to deal intelligently with cases where
authorTom Lane <tgl@sss.pgh.pa.us>
Mon, 6 Jul 2009 18:26:30 +0000 (18:26 +0000)
committerTom Lane <tgl@sss.pgh.pa.us>
Mon, 6 Jul 2009 18:26:30 +0000 (18:26 +0000)
commit91d2ff0529f091938cc92cf665d9cce7a9fc5892
treebd3a137a207d4c94e4a0a16eac48c824429246fc
parent6ce778c6500222286bf03631b6ee479de1bdda99
Fix set_append_rel_pathlist() to deal intelligently with cases where
substituting a child rel's output expressions into the appendrel's restriction
clauses yields a pseudoconstant restriction.  We might be able to skip scanning
that child rel entirely (if we get constant FALSE), or generate a one-time
filter.  8.3 more or less accidentally generated plans that weren't completely
stupid in these cases, but that was only because an extra recursive level of
subquery_planner() always occurred and allowed const-simplification to happen.
8.4's ability to pull up appendrel members with non-Var outputs exposes the
fact that we need to work harder here.  Per gripe from Sergey Burladyan.
src/backend/optimizer/path/allpaths.c
src/backend/optimizer/prep/prepunion.c
src/backend/optimizer/util/restrictinfo.c
src/include/optimizer/restrictinfo.h