@@ -82,6 +82,7 @@ create_pickyappend_path(PlannerInfo *root,
82
82
83
83
/* Set 'partitioned column'-related clauses */
84
84
result -> cpath .custom_private = joinclauses ;
85
+ result -> cpath .custom_paths = NIL ;
85
86
86
87
Assert (inner_entry -> relid != 0 );
87
88
result -> relid = inner_entry -> relid ;
@@ -98,14 +99,19 @@ create_pickyappend_path(PlannerInfo *root,
98
99
child -> content_type = CHILD_PATH ;
99
100
child -> content .path = path ;
100
101
child -> relid = root -> simple_rte_array [relindex ]-> relid ;
101
-
102
102
Assert (child -> relid != InvalidOid );
103
103
104
104
result -> children [i ++ ]= child ;
105
105
}
106
+
106
107
qsort (result -> children ,result -> nchildren ,
107
108
sizeof (ChildScanCommon ),cmp_child_scan_common );
108
109
110
+ /* Fill 'custom_paths' with paths in sort order */
111
+ for (i = 0 ;i < result -> nchildren ;i ++ )
112
+ result -> cpath .custom_paths = lappend (result -> cpath .custom_paths ,
113
+ result -> children [i ]-> content .path );
114
+
109
115
return & result -> cpath .path ;
110
116
}
111
117
@@ -177,14 +183,10 @@ save_pickyappend_private(CustomScan *cscan, PickyAppendPath *path, PlannerInfo *
177
183
List * custom_oids = NIL ;
178
184
int i ;
179
185
180
- cscan -> custom_plans = NIL ;
181
-
182
186
for (i = 0 ;i < nchildren ;i ++ )
183
187
{
188
+ /* We've already filled 'custom_paths' in create_pickyappend_path */
184
189
custom_oids = lappend_oid (custom_oids ,children [i ]-> relid );
185
- cscan -> custom_plans = lappend (cscan -> custom_plans ,
186
- create_plan (root ,children [i ]-> content .path ));
187
-
188
190
pfree (children [i ]);
189
191
}
190
192
@@ -233,7 +235,6 @@ create_pickyappend_plan(PlannerInfo *root, RelOptInfo *rel,
233
235
cscan -> scan .scanrelid = 0 ;
234
236
235
237
cscan -> custom_exprs = gpath -> cpath .custom_private ;
236
- //cscan->custom_exprs = NIL; /* TODO: fix */
237
238
238
239
cscan -> methods = & pickyappend_plan_methods ;
239
240
@@ -299,9 +300,9 @@ pickyappend_rescan(CustomScanState *node)
299
300
300
301
foreach (lc ,ranges )
301
302
{
302
- /* elog(LOG, "lower: %d, upper: %d",
303
+ elog (LOG ,"lower: %d, upper: %d" ,
303
304
irange_lower (lfirst_irange (lc )),
304
- irange_upper(lfirst_irange(lc)));*/
305
+ irange_upper (lfirst_irange (lc )));
305
306
}
306
307
}
307
308