Skip to content

Commit 2561f96

Browse files
committed
small refactoring
1 parent c9f7c99 commit 2561f96

File tree

1 file changed

+9
-20
lines changed

1 file changed

+9
-20
lines changed

pg_pathman.c

Lines changed: 9 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -429,14 +429,19 @@ pathman_set_rel_pathlist_hook(PlannerInfo *root, RelOptInfo *rel, Index rti, Ran
429429
RangeTblEntry **new_rte_array;
430430
int len;
431431
bool 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

434439
if (!pg_pathman_enable)
435-
goto original_hook;
440+
return;
436441

437442
/* This works only for SELECT queries */
438443
if (root->parse->commandType != CMD_SELECT || !inheritance_disabled)
439-
goto original_hook;
444+
return;
440445

441446
/* Lookup partitioning information for parent relation */
442447
prel = get_pathman_relation_info(rte->relid, &found);
@@ -540,18 +545,10 @@ pathman_set_rel_pathlist_hook(PlannerInfo *root, RelOptInfo *rel, Index rti, Ran
540545
foreach(lc, ranges)
541546
{
542547
IndexRange irange = lfirst_irange(lc);
543-
Oid childOid;
544548

545549
for (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
561558
set_append_rel_pathlist(root, rel, rti, rte, pathkeyAsc, pathkeyDesc);
562559
set_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

574563
static void

0 commit comments

Comments
 (0)