Skip to content

Commit c381326

Browse files
committed
Guard against parallel-restricted functions in VALUES expressions.
Obvious brain fade in set_rel_consider_parallel(). Noticed it while adjusting the adjacent RTE_FUNCTION case. In 9.6, also make the code look more like what I just did in HEAD by removing the unnecessary function_rte_parallel_ok subroutine (it does nothing that expression_tree_walker wouldn't do).
1 parent 0440f49 commit c381326

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
static void create_plain_partial_paths(PlannerInfo *root, RelOptInfo *rel);
7979
static void set_rel_consider_parallel(PlannerInfo *root, RelOptInfo *rel,
8080
RangeTblEntry *rte);
81-
static bool function_rte_parallel_ok(RangeTblEntry *rte);
8281
static void set_plain_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
8382
RangeTblEntry *rte);
8483
static void set_tablesample_rel_size(PlannerInfo *root, RelOptInfo *rel,
@@ -596,16 +595,14 @@ set_rel_consider_parallel(PlannerInfo *root, RelOptInfo *rel,
596595

597596
case RTE_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
case RTE_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
case RTE_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-
static bool
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)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy