|
10 | 10 | * |
11 | 11 | * |
12 | 12 | * IDENTIFICATION |
13 | | - * $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.226 2007/02/22 22:00:24 tgl Exp $ |
| 13 | + * $PostgreSQL: pgsql/src/backend/optimizer/plan/createplan.c,v 1.227 2007/02/25 17:44:01 tgl Exp $ |
14 | 14 | * |
15 | 15 | *------------------------------------------------------------------------- |
16 | 16 | */ |
@@ -2740,7 +2740,11 @@ make_sort_from_pathkeys(PlannerInfo *root, Plan *lefttree, List *pathkeys) |
2740 | 2740 | * Do we need to insert a Result node? |
2741 | 2741 | */ |
2742 | 2742 | if (!is_projection_capable_plan(lefttree)) |
| 2743 | +{ |
| 2744 | +/* copy needed so we don't modify input's tlist below */ |
| 2745 | +tlist=copyObject(tlist); |
2743 | 2746 | lefttree= (Plan*)make_result(root,tlist,NULL,lefttree); |
| 2747 | +} |
2744 | 2748 |
|
2745 | 2749 | /* |
2746 | 2750 | * Add resjunk entry to input's tlist |
|