*** pgsql/src/backend/optimizer/path/joinpath.c 2009/06/11 14:48:59 1.122 --- pgsql/src/backend/optimizer/path/joinpath.c 2009/09/12 22:12:04 1.123 *************** *** 8,14 **** * * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/backend/optimizer/path/joinpath.c,v 1.121 2009/02/05 01:24:55 tgl Exp $ * *------------------------------------------------------------------------- */ --- 8,14 ---- * * * IDENTIFICATION ! * $PostgreSQL: pgsql/src/backend/optimizer/path/joinpath.c,v 1.122 2009/06/11 14:48:59 momjian Exp $ * *------------------------------------------------------------------------- */ *************** *** 16,21 **** --- 16,22 ---- #include <math.h> + #include "executor/executor.h" #include "optimizer/cost.h" #include "optimizer/pathnode.h" #include "optimizer/paths.h" *************** match_unsorted_outer(PlannerInfo *root, *** 405,422 **** else if (nestjoinOK) { /* ! * If the cheapest inner path is a join or seqscan, we should consider ! * materializing it. (This is a heuristic: we could consider it ! * always, but for inner indexscans it's probably a waste of time.) ! * Also skip it if the inner path materializes its output anyway. */ ! if (!(inner_cheapest_total->pathtype == T_IndexScan || ! inner_cheapest_total->pathtype == T_BitmapHeapScan || ! inner_cheapest_total->pathtype == T_TidScan || ! inner_cheapest_total->pathtype == T_Material || ! inner_cheapest_total->pathtype == T_FunctionScan || ! inner_cheapest_total->pathtype == T_CteScan || ! inner_cheapest_total->pathtype == T_WorkTableScan)) matpath = (Path *) create_material_path(innerrel, inner_cheapest_total); --- 406,415 ---- else if (nestjoinOK) { /* ! * Consider materializing the cheapest inner path, unless it is one ! * that materializes its output anyway. */ ! if (!ExecMaterializesOutput(inner_cheapest_total->pathtype)) matpath = (Path *) create_material_path(innerrel, inner_cheapest_total);