@@ -429,14 +429,19 @@ pathman_set_rel_pathlist_hook(PlannerInfo *root, RelOptInfo *rel, Index rti, Ran
429429RangeTblEntry * * new_rte_array ;
430430int len ;
431431bool found ;
432- int first_child_relid = 0 ;
432+
433+ /* Invoke original hook if needed */
434+ if (set_rel_pathlist_hook_original != NULL )
435+ {
436+ set_rel_pathlist_hook_original (root ,rel ,rti ,rte );
437+ }
433438
434439if (!pg_pathman_enable )
435- goto original_hook ;
440+ return ;
436441
437442/* This works only for SELECT queries */
438443if (root -> parse -> commandType != CMD_SELECT || !inheritance_disabled )
439- goto original_hook ;
444+ return ;
440445
441446/* Lookup partitioning information for parent relation */
442447prel = get_pathman_relation_info (rte -> relid ,& found );
@@ -540,18 +545,10 @@ pathman_set_rel_pathlist_hook(PlannerInfo *root, RelOptInfo *rel, Index rti, Ran
540545foreach (lc ,ranges )
541546{
542547IndexRange irange = lfirst_irange (lc );
543- Oid childOid ;
544548
545549for (i = irange_lower (irange );i <=irange_upper (irange );i ++ )
546- {
547- int idx ;
550+ append_child_relation (root ,rel ,rti ,rte ,i ,dsm_arr [i ],wrappers );
548551
549- childOid = dsm_arr [i ];
550- idx = append_child_relation (root ,rel ,rti ,rte ,i ,childOid ,wrappers );
551-
552- if (!first_child_relid )
553- first_child_relid = idx ;
554- }
555552}
556553
557554/* Clear old path list */
@@ -561,14 +558,6 @@ pathman_set_rel_pathlist_hook(PlannerInfo *root, RelOptInfo *rel, Index rti, Ran
561558set_append_rel_pathlist (root ,rel ,rti ,rte ,pathkeyAsc ,pathkeyDesc );
562559set_append_rel_size (root ,rel ,rti ,rte );
563560}
564-
565- original_hook :
566-
567- /* Invoke original hook if needed */
568- if (set_rel_pathlist_hook_original != NULL )
569- {
570- set_rel_pathlist_hook_original (root ,rel ,rti ,rte );
571- }
572561}
573562
574563static void