| From: | Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us> | 
|---|---|
| To: | David Schmitt <david(at)dasz(dot)at> | 
| Cc: | pgsql-bugs(at)postgresql(dot)org | 
| Subject: | Re: BUG #5673: Optimizer creates strange execution plan leading to wrong results | 
| Date: | 2010-09-23 19:53:19 | 
| Message-ID: | 1782.1285271599@sss.pgh.pa.us | 
| Views: | Whole Thread | Raw Message | Download mbox | Resend email | 
| Thread: | |
| Lists: | pgsql-bugs | 
David Schmitt <david(at)dasz(dot)at> writes:
> Executing the attached example.sql on a fresh database demonstrates the 
> problem I'm seeing:
Found it. If you need a patch right away, it's a one-liner:
diff --git a/src/backend/optimizer/path/allpaths.c b/src/backend/optimizer/path/allpaths.c
index 2d86da3..b7cf0b8 100644
--- a/src/backend/optimizer/path/allpaths.c
+++ b/src/backend/optimizer/path/allpaths.c
@@ -425,7 +425,7 @@ set_append_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
 		childpath = childrel->cheapest_total_path;
 		if (IsA(childpath, AppendPath))
 			subpaths = list_concat(subpaths,
-								   ((AppendPath *) childpath)->subpaths);
+							list_copy(((AppendPath *) childpath)->subpaths));
 		else
 			subpaths = lappend(subpaths, childpath);
 
regards, tom lane
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Tom Lane | 2010-09-23 20:19:46 | Re: Feature request - pg_dump - -W specify pwd in command line | 
| Previous Message | Tom Lane | 2010-09-23 18:08:18 | Re: BUG #5673: Optimizer creates strange execution plan leading to wrong results |