Skip to content

Commit ea6564c

Browse files
committed
pathman: small refactoring
1 parent 8f446b9 commit ea6564c

File tree

1 file changed

+9
-20
lines changed

1 file changed

+9
-20
lines changed

contrib/pg_pathman/pg_pathman.c

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -443,14 +443,19 @@ pathman_set_rel_pathlist_hook(PlannerInfo *root, RelOptInfo *rel, Index rti, Ran
443443
RangeTblEntry **new_rte_array;
444444
int len;
445445
bool found;
446-
int first_child_relid = 0;
446+
447+
/* Invoke original hook if needed */
448+
if (set_rel_pathlist_hook_original != NULL)
449+
{
450+
set_rel_pathlist_hook_original(root, rel, rti, rte);
451+
}
447452

448453
if (!pg_pathman_enable)
449-
goto original_hook;
454+
return;
450455

451456
/* This works only for SELECT queries */
452457
if (root->parse->commandType != CMD_SELECT || !inheritance_disabled)
453-
goto original_hook;
458+
return;
454459

455460
/* Lookup partitioning information for parent relation */
456461
prel = get_pathman_relation_info(rte->relid, &found);
@@ -554,18 +559,10 @@ pathman_set_rel_pathlist_hook(PlannerInfo *root, RelOptInfo *rel, Index rti, Ran
554559
foreach(lc, ranges)
555560
{
556561
IndexRange irange = lfirst_irange(lc);
557-
Oid childOid;
558562

559563
for (i = irange_lower(irange); i <= irange_upper(irange); i++)
560-
{
561-
int idx;
564+
append_child_relation(root, rel, rti, rte, i, dsm_arr[i], wrappers);
562565

563-
childOid = dsm_arr[i];
564-
idx = append_child_relation(root, rel, rti, rte, i, childOid, wrappers);
565-
566-
if (!first_child_relid)
567-
first_child_relid = idx;
568-
}
569566
}
570567

571568
/* Clear old path list */
@@ -575,14 +572,6 @@ pathman_set_rel_pathlist_hook(PlannerInfo *root, RelOptInfo *rel, Index rti, Ran
575572
set_append_rel_pathlist(root, rel, rti, rte, pathkeyAsc, pathkeyDesc);
576573
set_append_rel_size(root, rel, rti, rte);
577574
}
578-
579-
original_hook:
580-
581-
/* Invoke original hook if needed */
582-
if (set_rel_pathlist_hook_original != NULL)
583-
{
584-
set_rel_pathlist_hook_original(root, rel, rti, rte);
585-
}
586575
}
587576

588577
static void

0 commit comments

Comments
 (0)