aboutsummaryrefslogtreecommitdiff
path: root/src/backend/optimizer/geqo/geqo_eval.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/optimizer/geqo/geqo_eval.c')
-rw-r--r--src/backend/optimizer/geqo/geqo_eval.c11
1 files changed, 10 insertions, 1 deletions
diff --git a/src/backend/optimizer/geqo/geqo_eval.c b/src/backend/optimizer/geqo/geqo_eval.c
index 1e352fd3b5e..57eb2c39a4f 100644
--- a/src/backend/optimizer/geqo/geqo_eval.c
+++ b/src/backend/optimizer/geqo/geqo_eval.c
@@ -56,6 +56,7 @@ geqo_eval(PlannerInfo *root, Gene *tour, int num_gene)
MemoryContext mycontext;
MemoryContext oldcxt;
RelOptInfo *joinrel;
+ Path *best_path;
Cost fitness;
int savelength;
struct HTAB *savehash;
@@ -99,6 +100,14 @@ geqo_eval(PlannerInfo *root, Gene *tour, int num_gene)
/* construct the best path for the given combination of relations */
joinrel = gimme_tree(root, tour, num_gene);
+ best_path = joinrel->cheapest_total_path;
+
+ /*
+ * If no unparameterized path, use the cheapest parameterized path for
+ * costing purposes. XXX revisit this after LATERAL dust settles
+ */
+ if (!best_path)
+ best_path = linitial(joinrel->cheapest_parameterized_paths);
/*
* compute fitness
@@ -106,7 +115,7 @@ geqo_eval(PlannerInfo *root, Gene *tour, int num_gene)
* XXX geqo does not currently support optimization for partial result
* retrieval --- how to fix?
*/
- fitness = joinrel->cheapest_total_path->total_cost;
+ fitness = best_path->total_cost;
/*
* Restore join_rel_list to its former state, and put back original