@@ -181,12 +181,9 @@ static Path *
181
181
create_pickyappend_path (PlannerInfo * root ,
182
182
AppendPath * inner_append ,
183
183
ParamPathInfo * param_info ,
184
- JoinPathExtraData * extra )
184
+ List * picky_clauses )
185
185
{
186
186
RelOptInfo * innerrel = inner_append -> path .parent ;
187
- List * joinrestrictclauses = extra -> restrictlist ;
188
- List * joinclauses ;
189
- List * otherclauses ;
190
187
ListCell * lc ;
191
188
int i ;
192
189
@@ -197,18 +194,6 @@ create_pickyappend_path(PlannerInfo *root,
197
194
result = palloc0 (sizeof (PickyAppendPath ));
198
195
NodeSetTag (result ,T_CustomPath );
199
196
200
- if (IS_OUTER_JOIN (extra -> sjinfo -> jointype ))
201
- {
202
- extract_actual_join_clauses (joinrestrictclauses ,
203
- & joinclauses ,& otherclauses );
204
- }
205
- else
206
- {
207
- /* We can treat all clauses alike for an inner join */
208
- joinclauses = extract_actual_clauses (joinrestrictclauses , false);
209
- otherclauses = NIL ;
210
- }
211
-
212
197
result -> cpath .path .pathtype = T_CustomScan ;
213
198
result -> cpath .path .parent = innerrel ;
214
199
result -> cpath .path .param_info = param_info ;
@@ -225,7 +210,7 @@ create_pickyappend_path(PlannerInfo *root,
225
210
result -> cpath .path .total_cost = 0 ;
226
211
227
212
/* Set 'partitioned column'-related clauses */
228
- result -> cpath .custom_private = joinclauses ;
213
+ result -> cpath .custom_private = picky_clauses ;
229
214
result -> cpath .custom_paths = NIL ;
230
215
231
216
Assert (inner_entry -> relid != 0 );
@@ -270,6 +255,9 @@ pathman_join_pathlist_hook(PlannerInfo *root,
270
255
PartRelationInfo * inner_prel ;
271
256
NestPath * nest_path ;
272
257
List * pathkeys = NIL ;
258
+ List * joinrestrictclauses = extra -> restrictlist ;
259
+ List * joinclauses ,
260
+ * otherclauses ;
273
261
ListCell * lc ;
274
262
275
263
if (set_join_pathlist_next )
@@ -286,6 +274,19 @@ pathman_join_pathlist_hook(PlannerInfo *root,
286
274
return ;/* Obviously not our case */
287
275
}
288
276
277
+ /* Extract join clauses which will separate partitions */
278
+ if (IS_OUTER_JOIN (extra -> sjinfo -> jointype ))
279
+ {
280
+ extract_actual_join_clauses (joinrestrictclauses ,
281
+ & joinclauses ,& otherclauses );
282
+ }
283
+ else
284
+ {
285
+ /* We can treat all clauses alike for an inner join */
286
+ joinclauses = extract_actual_clauses (joinrestrictclauses , false);
287
+ otherclauses = NIL ;
288
+ }
289
+
289
290
foreach (lc ,innerrel -> pathlist )
290
291
{
291
292
AppendPath * cur_inner_path = (AppendPath * )lfirst (lc );
@@ -301,19 +302,19 @@ pathman_join_pathlist_hook(PlannerInfo *root,
301
302
inner = create_pickyappend_path (root ,cur_inner_path ,
302
303
get_appendrel_parampathinfo (innerrel ,
303
304
inner_required ),
304
- extra );
305
+ joinclauses );
305
306
306
307
initial_cost_nestloop (root ,& workspace ,jointype ,
307
- outer ,inner ,
308
- extra -> sjinfo ,& extra -> semifactors );
308
+ outer ,inner ,
309
+ extra -> sjinfo ,& extra -> semifactors );
309
310
310
311
pathkeys = build_join_pathkeys (root ,joinrel ,jointype ,outer -> pathkeys );
311
312
312
313
nest_path = create_nestloop_path (root ,joinrel ,jointype ,& workspace ,
313
- extra -> sjinfo ,& extra -> semifactors ,
314
- outer ,inner ,extra -> restrictlist ,
315
- pathkeys ,
316
- calc_nestloop_required_outer (outer ,inner ));
314
+ extra -> sjinfo ,& extra -> semifactors ,
315
+ outer ,inner ,extra -> restrictlist ,
316
+ pathkeys ,
317
+ calc_nestloop_required_outer (outer ,inner ));
317
318
318
319
add_path (joinrel , (Path * )nest_path );
319
320
}