@@ -369,6 +369,8 @@ pathman_rel_pathlist_hook(PlannerInfo *root,
369
369
* FROM test.tmp2 t2
370
370
* WHERE id = t.id);
371
371
*
372
+ * or unions, multilevel partitioning, etc.
373
+ *
372
374
* Since we disable optimizations on 9.5, we
373
375
* have to skip parent table that has already
374
376
* been expanded by standard inheritance.
@@ -378,23 +380,18 @@ pathman_rel_pathlist_hook(PlannerInfo *root,
378
380
foreach (lc , root -> append_rel_list )
379
381
{
380
382
AppendRelInfo * appinfo = (AppendRelInfo * ) lfirst (lc );
381
- RangeTblEntry * cur_parent_rte ,
382
- * cur_child_rte ;
383
-
384
- /* This 'appinfo' is not for this child */
385
- if (appinfo -> child_relid != rti )
386
- continue ;
387
-
388
- cur_parent_rte = root -> simple_rte_array [appinfo -> parent_relid ];
389
- cur_child_rte = rte ; /* we already have it, saves time */
390
383
391
- /* This child == its own parent table! */
392
- if (cur_parent_rte -> relid == cur_child_rte -> relid )
384
+ /*
385
+ * If there's an 'appinfo', it means that somebody
386
+ * (PG?) has already processed this partitioned table
387
+ * and added its children to the plan.
388
+ */
389
+ if (appinfo -> child_relid == rti )
393
390
return ;
394
391
}
395
392
}
396
393
397
- /* Make copy of partitioning expression and fix Var's varno attributes */
394
+ /* Make copy of partitioning expression and fix Var's varno attributes */
398
395
part_expr = PrelExpressionForRelid (prel , rti );
399
396
400
397
/* Get partitioning-related clauses (do this before append_child_relation()) */
0 commit comments