Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitc381326

Browse files
committed
Guard against parallel-restricted functions in VALUES expressions.
Obvious brain fade in set_rel_consider_parallel(). Noticed it whileadjusting the adjacent RTE_FUNCTION case.In 9.6, also make the code look more like what I just did in HEADby removing the unnecessary function_rte_parallel_ok subroutine(it does nothing that expression_tree_walker wouldn't do).
1 parent0440f49 commitc381326

File tree

1 file changed

+4
-27
lines changed

1 file changed

+4
-27
lines changed

‎src/backend/optimizer/path/allpaths.c

Lines changed: 4 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ static void set_plain_rel_size(PlannerInfo *root, RelOptInfo *rel,
7878
staticvoidcreate_plain_partial_paths(PlannerInfo*root,RelOptInfo*rel);
7979
staticvoidset_rel_consider_parallel(PlannerInfo*root,RelOptInfo*rel,
8080
RangeTblEntry*rte);
81-
staticboolfunction_rte_parallel_ok(RangeTblEntry*rte);
8281
staticvoidset_plain_rel_pathlist(PlannerInfo*root,RelOptInfo*rel,
8382
RangeTblEntry*rte);
8483
staticvoidset_tablesample_rel_size(PlannerInfo*root,RelOptInfo*rel,
@@ -596,16 +595,14 @@ set_rel_consider_parallel(PlannerInfo *root, RelOptInfo *rel,
596595

597596
caseRTE_FUNCTION:
598597
/* Check for parallel-restricted functions. */
599-
if (!function_rte_parallel_ok(rte))
598+
if (has_parallel_hazard((Node*)rte->functions, false))
600599
return;
601600
break;
602601

603602
caseRTE_VALUES:
604-
605-
/*
606-
* The data for a VALUES clause is stored in the plan tree itself,
607-
* so scanning it in a worker is fine.
608-
*/
603+
/* Check for parallel-restricted functions. */
604+
if (has_parallel_hazard((Node*)rte->values_lists, false))
605+
return;
609606
break;
610607

611608
caseRTE_CTE:
@@ -643,26 +640,6 @@ set_rel_consider_parallel(PlannerInfo *root, RelOptInfo *rel,
643640
rel->consider_parallel= true;
644641
}
645642

646-
/*
647-
* Check whether a function RTE is scanning something parallel-restricted.
648-
*/
649-
staticbool
650-
function_rte_parallel_ok(RangeTblEntry*rte)
651-
{
652-
ListCell*lc;
653-
654-
foreach(lc,rte->functions)
655-
{
656-
RangeTblFunction*rtfunc= (RangeTblFunction*)lfirst(lc);
657-
658-
Assert(IsA(rtfunc,RangeTblFunction));
659-
if (has_parallel_hazard(rtfunc->funcexpr, false))
660-
return false;
661-
}
662-
663-
return true;
664-
}
665-
666643
/*
667644
* set_plain_rel_pathlist
668645
* Build access paths for a plain relation (no subquery, no inheritance)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp