mirror of
https://git.postgresql.org/git/postgresql.git
synced 2024-08-28 13:47:19 +02:00
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).
This commit is contained in:
parent
0440f49523
commit
c3813268a7
@ -78,7 +78,6 @@ static void set_plain_rel_size(PlannerInfo *root, RelOptInfo *rel,
|
||||
static void create_plain_partial_paths(PlannerInfo *root, RelOptInfo *rel);
|
||||
static void set_rel_consider_parallel(PlannerInfo *root, RelOptInfo *rel,
|
||||
RangeTblEntry *rte);
|
||||
static bool function_rte_parallel_ok(RangeTblEntry *rte);
|
||||
static void set_plain_rel_pathlist(PlannerInfo *root, RelOptInfo *rel,
|
||||
RangeTblEntry *rte);
|
||||
static void set_tablesample_rel_size(PlannerInfo *root, RelOptInfo *rel,
|
||||
@ -596,16 +595,14 @@ set_rel_consider_parallel(PlannerInfo *root, RelOptInfo *rel,
|
||||
|
||||
case RTE_FUNCTION:
|
||||
/* Check for parallel-restricted functions. */
|
||||
if (!function_rte_parallel_ok(rte))
|
||||
if (has_parallel_hazard((Node *) rte->functions, false))
|
||||
return;
|
||||
break;
|
||||
|
||||
case RTE_VALUES:
|
||||
|
||||
/*
|
||||
* The data for a VALUES clause is stored in the plan tree itself,
|
||||
* so scanning it in a worker is fine.
|
||||
*/
|
||||
/* Check for parallel-restricted functions. */
|
||||
if (has_parallel_hazard((Node *) rte->values_lists, false))
|
||||
return;
|
||||
break;
|
||||
|
||||
case RTE_CTE:
|
||||
@ -643,26 +640,6 @@ set_rel_consider_parallel(PlannerInfo *root, RelOptInfo *rel,
|
||||
rel->consider_parallel = true;
|
||||
}
|
||||
|
||||
/*
|
||||
* Check whether a function RTE is scanning something parallel-restricted.
|
||||
*/
|
||||
static bool
|
||||
function_rte_parallel_ok(RangeTblEntry *rte)
|
||||
{
|
||||
ListCell *lc;
|
||||
|
||||
foreach(lc, rte->functions)
|
||||
{
|
||||
RangeTblFunction *rtfunc = (RangeTblFunction *) lfirst(lc);
|
||||
|
||||
Assert(IsA(rtfunc, RangeTblFunction));
|
||||
if (has_parallel_hazard(rtfunc->funcexpr, false))
|
||||
return false;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/*
|
||||
* set_plain_rel_pathlist
|
||||
* Build access paths for a plain relation (no subquery, no inheritance)
|
||||
|
Loading…
Reference in New Issue
Block a user