aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2004-12-15 21:13:34 +0000
committerTom Lane <tgl@sss.pgh.pa.us>2004-12-15 21:13:34 +0000
commitdd29fc2f61e91df8d5879b2dfd02bbabafa182ff (patch)
tree75dca4cdc77137089bcd7a6cb982a416121e0f25
parent84dbd5a8f60cdb27270ffc1f105cf1b1bb3c1ddc (diff)
downloadpostgresql-dd29fc2f61e91df8d5879b2dfd02bbabafa182ff.tar.gz
postgresql-dd29fc2f61e91df8d5879b2dfd02bbabafa182ff.zip
Fix another place broken by new List implementation :-(. Per example
from goranpop@nspoint.net. I think this escaped notice because in simple cases the list is NIL on entry.
-rw-r--r--src/backend/optimizer/geqo/geqo_eval.c13
1 files changed, 9 insertions, 4 deletions
diff --git a/src/backend/optimizer/geqo/geqo_eval.c b/src/backend/optimizer/geqo/geqo_eval.c
index 90aa34fa591..254fcd89566 100644
--- a/src/backend/optimizer/geqo/geqo_eval.c
+++ b/src/backend/optimizer/geqo/geqo_eval.c
@@ -6,7 +6,7 @@
* Portions Copyright (c) 1996-2004, PostgreSQL Global Development Group
* Portions Copyright (c) 1994, Regents of the University of California
*
- * $PostgreSQL: pgsql/src/backend/optimizer/geqo/geqo_eval.c,v 1.71 2004/08/29 05:06:43 momjian Exp $
+ * $PostgreSQL: pgsql/src/backend/optimizer/geqo/geqo_eval.c,v 1.72 2004/12/15 21:13:34 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -80,12 +80,17 @@ geqo_eval(Gene *tour, int num_gene, GeqoEvalData *evaldata)
oldcxt = MemoryContextSwitchTo(mycontext);
/*
- * preserve root->join_rel_list, which gimme_tree changes; without
- * this, it'll be pointing at recycled storage after the
- * MemoryContextDelete below.
+ * gimme_tree will add entries to root->join_rel_list, which may or may
+ * not already contain some entries. The newly added entries will be
+ * recycled by the MemoryContextDelete below, so we must ensure that
+ * the list is restored to its former state before exiting. With the
+ * new List implementation, the easiest way is to make a duplicate list
+ * that gimme_tree can modify.
*/
savelist = evaldata->root->join_rel_list;
+ evaldata->root->join_rel_list = list_copy(savelist);
+
/* construct the best path for the given combination of relations */
joinrel = gimme_tree(tour, num_gene, evaldata);