mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
Rethink representation of PathTargets.
In commit 19a541143a
I did not make PathTarget a subtype of Node,
and embedded a RelOptInfo's reltarget directly into it rather than having
a separately-allocated Node. In hindsight that was misguided
micro-optimization, enabled by the fact that at that point we didn't have
any Paths with custom PathTargets. Now that PathTarget processing has
been fleshed out some more, it's easier to see that it's better to have
PathTarget as an indepedent Node type, even if it does cost us one more
palloc to create a RelOptInfo. So change it while we still can.
This commit just changes the representation, without doing anything more
interesting than that.
This commit is contained in:
@ -929,7 +929,7 @@ create_seqscan_path(PlannerInfo *root, RelOptInfo *rel,
|
||||
|
||||
pathnode->pathtype = T_SeqScan;
|
||||
pathnode->parent = rel;
|
||||
pathnode->pathtarget = &(rel->reltarget);
|
||||
pathnode->pathtarget = rel->reltarget;
|
||||
pathnode->param_info = get_baserel_parampathinfo(root, rel,
|
||||
required_outer);
|
||||
pathnode->parallel_aware = parallel_degree > 0 ? true : false;
|
||||
@ -953,7 +953,7 @@ create_samplescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer
|
||||
|
||||
pathnode->pathtype = T_SampleScan;
|
||||
pathnode->parent = rel;
|
||||
pathnode->pathtarget = &(rel->reltarget);
|
||||
pathnode->pathtarget = rel->reltarget;
|
||||
pathnode->param_info = get_baserel_parampathinfo(root, rel,
|
||||
required_outer);
|
||||
pathnode->parallel_aware = false;
|
||||
@ -1010,7 +1010,7 @@ create_index_path(PlannerInfo *root,
|
||||
|
||||
pathnode->path.pathtype = indexonly ? T_IndexOnlyScan : T_IndexScan;
|
||||
pathnode->path.parent = rel;
|
||||
pathnode->path.pathtarget = &(rel->reltarget);
|
||||
pathnode->path.pathtarget = rel->reltarget;
|
||||
pathnode->path.param_info = get_baserel_parampathinfo(root, rel,
|
||||
required_outer);
|
||||
pathnode->path.parallel_aware = false;
|
||||
@ -1059,7 +1059,7 @@ create_bitmap_heap_path(PlannerInfo *root,
|
||||
|
||||
pathnode->path.pathtype = T_BitmapHeapScan;
|
||||
pathnode->path.parent = rel;
|
||||
pathnode->path.pathtarget = &(rel->reltarget);
|
||||
pathnode->path.pathtarget = rel->reltarget;
|
||||
pathnode->path.param_info = get_baserel_parampathinfo(root, rel,
|
||||
required_outer);
|
||||
pathnode->path.parallel_aware = false;
|
||||
@ -1089,7 +1089,7 @@ create_bitmap_and_path(PlannerInfo *root,
|
||||
|
||||
pathnode->path.pathtype = T_BitmapAnd;
|
||||
pathnode->path.parent = rel;
|
||||
pathnode->path.pathtarget = &(rel->reltarget);
|
||||
pathnode->path.pathtarget = rel->reltarget;
|
||||
pathnode->path.param_info = NULL; /* not used in bitmap trees */
|
||||
|
||||
/*
|
||||
@ -1125,7 +1125,7 @@ create_bitmap_or_path(PlannerInfo *root,
|
||||
|
||||
pathnode->path.pathtype = T_BitmapOr;
|
||||
pathnode->path.parent = rel;
|
||||
pathnode->path.pathtarget = &(rel->reltarget);
|
||||
pathnode->path.pathtarget = rel->reltarget;
|
||||
pathnode->path.param_info = NULL; /* not used in bitmap trees */
|
||||
|
||||
/*
|
||||
@ -1160,7 +1160,7 @@ create_tidscan_path(PlannerInfo *root, RelOptInfo *rel, List *tidquals,
|
||||
|
||||
pathnode->path.pathtype = T_TidScan;
|
||||
pathnode->path.parent = rel;
|
||||
pathnode->path.pathtarget = &(rel->reltarget);
|
||||
pathnode->path.pathtarget = rel->reltarget;
|
||||
pathnode->path.param_info = get_baserel_parampathinfo(root, rel,
|
||||
required_outer);
|
||||
pathnode->path.parallel_aware = false;
|
||||
@ -1192,7 +1192,7 @@ create_append_path(RelOptInfo *rel, List *subpaths, Relids required_outer,
|
||||
|
||||
pathnode->path.pathtype = T_Append;
|
||||
pathnode->path.parent = rel;
|
||||
pathnode->path.pathtarget = &(rel->reltarget);
|
||||
pathnode->path.pathtarget = rel->reltarget;
|
||||
pathnode->path.param_info = get_appendrel_parampathinfo(rel,
|
||||
required_outer);
|
||||
pathnode->path.parallel_aware = false;
|
||||
@ -1251,7 +1251,7 @@ create_merge_append_path(PlannerInfo *root,
|
||||
|
||||
pathnode->path.pathtype = T_MergeAppend;
|
||||
pathnode->path.parent = rel;
|
||||
pathnode->path.pathtarget = &(rel->reltarget);
|
||||
pathnode->path.pathtarget = rel->reltarget;
|
||||
pathnode->path.param_info = get_appendrel_parampathinfo(rel,
|
||||
required_outer);
|
||||
pathnode->path.parallel_aware = false;
|
||||
@ -1375,7 +1375,7 @@ create_material_path(RelOptInfo *rel, Path *subpath)
|
||||
|
||||
pathnode->path.pathtype = T_Material;
|
||||
pathnode->path.parent = rel;
|
||||
pathnode->path.pathtarget = &(rel->reltarget);
|
||||
pathnode->path.pathtarget = rel->reltarget;
|
||||
pathnode->path.param_info = subpath->param_info;
|
||||
pathnode->path.parallel_aware = false;
|
||||
pathnode->path.parallel_safe = rel->consider_parallel &&
|
||||
@ -1440,7 +1440,7 @@ create_unique_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath,
|
||||
|
||||
pathnode->path.pathtype = T_Unique;
|
||||
pathnode->path.parent = rel;
|
||||
pathnode->path.pathtarget = &(rel->reltarget);
|
||||
pathnode->path.pathtarget = rel->reltarget;
|
||||
pathnode->path.param_info = subpath->param_info;
|
||||
pathnode->path.parallel_aware = false;
|
||||
pathnode->path.parallel_safe = rel->consider_parallel &&
|
||||
@ -1656,7 +1656,7 @@ create_gather_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath,
|
||||
|
||||
pathnode->path.pathtype = T_Gather;
|
||||
pathnode->path.parent = rel;
|
||||
pathnode->path.pathtarget = &(rel->reltarget);
|
||||
pathnode->path.pathtarget = rel->reltarget;
|
||||
pathnode->path.param_info = get_baserel_parampathinfo(root, rel,
|
||||
required_outer);
|
||||
pathnode->path.parallel_aware = false;
|
||||
@ -1692,7 +1692,7 @@ create_subqueryscan_path(PlannerInfo *root, RelOptInfo *rel, Path *subpath,
|
||||
|
||||
pathnode->path.pathtype = T_SubqueryScan;
|
||||
pathnode->path.parent = rel;
|
||||
pathnode->path.pathtarget = &(rel->reltarget);
|
||||
pathnode->path.pathtarget = rel->reltarget;
|
||||
pathnode->path.param_info = get_baserel_parampathinfo(root, rel,
|
||||
required_outer);
|
||||
pathnode->path.parallel_aware = false;
|
||||
@ -1720,7 +1720,7 @@ create_functionscan_path(PlannerInfo *root, RelOptInfo *rel,
|
||||
|
||||
pathnode->pathtype = T_FunctionScan;
|
||||
pathnode->parent = rel;
|
||||
pathnode->pathtarget = &(rel->reltarget);
|
||||
pathnode->pathtarget = rel->reltarget;
|
||||
pathnode->param_info = get_baserel_parampathinfo(root, rel,
|
||||
required_outer);
|
||||
pathnode->parallel_aware = false;
|
||||
@ -1746,7 +1746,7 @@ create_valuesscan_path(PlannerInfo *root, RelOptInfo *rel,
|
||||
|
||||
pathnode->pathtype = T_ValuesScan;
|
||||
pathnode->parent = rel;
|
||||
pathnode->pathtarget = &(rel->reltarget);
|
||||
pathnode->pathtarget = rel->reltarget;
|
||||
pathnode->param_info = get_baserel_parampathinfo(root, rel,
|
||||
required_outer);
|
||||
pathnode->parallel_aware = false;
|
||||
@ -1771,7 +1771,7 @@ create_ctescan_path(PlannerInfo *root, RelOptInfo *rel, Relids required_outer)
|
||||
|
||||
pathnode->pathtype = T_CteScan;
|
||||
pathnode->parent = rel;
|
||||
pathnode->pathtarget = &(rel->reltarget);
|
||||
pathnode->pathtarget = rel->reltarget;
|
||||
pathnode->param_info = get_baserel_parampathinfo(root, rel,
|
||||
required_outer);
|
||||
pathnode->parallel_aware = false;
|
||||
@ -1797,7 +1797,7 @@ create_worktablescan_path(PlannerInfo *root, RelOptInfo *rel,
|
||||
|
||||
pathnode->pathtype = T_WorkTableScan;
|
||||
pathnode->parent = rel;
|
||||
pathnode->pathtarget = &(rel->reltarget);
|
||||
pathnode->pathtarget = rel->reltarget;
|
||||
pathnode->param_info = get_baserel_parampathinfo(root, rel,
|
||||
required_outer);
|
||||
pathnode->parallel_aware = false;
|
||||
@ -1833,7 +1833,7 @@ create_foreignscan_path(PlannerInfo *root, RelOptInfo *rel,
|
||||
|
||||
pathnode->path.pathtype = T_ForeignScan;
|
||||
pathnode->path.parent = rel;
|
||||
pathnode->path.pathtarget = &(rel->reltarget);
|
||||
pathnode->path.pathtarget = rel->reltarget;
|
||||
pathnode->path.param_info = get_baserel_parampathinfo(root, rel,
|
||||
required_outer);
|
||||
pathnode->path.parallel_aware = false;
|
||||
@ -1966,7 +1966,7 @@ create_nestloop_path(PlannerInfo *root,
|
||||
|
||||
pathnode->path.pathtype = T_NestLoop;
|
||||
pathnode->path.parent = joinrel;
|
||||
pathnode->path.pathtarget = &(joinrel->reltarget);
|
||||
pathnode->path.pathtarget = joinrel->reltarget;
|
||||
pathnode->path.param_info =
|
||||
get_joinrel_parampathinfo(root,
|
||||
joinrel,
|
||||
@ -2029,7 +2029,7 @@ create_mergejoin_path(PlannerInfo *root,
|
||||
|
||||
pathnode->jpath.path.pathtype = T_MergeJoin;
|
||||
pathnode->jpath.path.parent = joinrel;
|
||||
pathnode->jpath.path.pathtarget = &(joinrel->reltarget);
|
||||
pathnode->jpath.path.pathtarget = joinrel->reltarget;
|
||||
pathnode->jpath.path.param_info =
|
||||
get_joinrel_parampathinfo(root,
|
||||
joinrel,
|
||||
@ -2091,7 +2091,7 @@ create_hashjoin_path(PlannerInfo *root,
|
||||
|
||||
pathnode->jpath.path.pathtype = T_HashJoin;
|
||||
pathnode->jpath.path.parent = joinrel;
|
||||
pathnode->jpath.path.pathtarget = &(joinrel->reltarget);
|
||||
pathnode->jpath.path.pathtarget = joinrel->reltarget;
|
||||
pathnode->jpath.path.param_info =
|
||||
get_joinrel_parampathinfo(root,
|
||||
joinrel,
|
||||
@ -2876,7 +2876,7 @@ create_modifytable_path(PlannerInfo *root, RelOptInfo *rel,
|
||||
pathnode->path.pathtype = T_ModifyTable;
|
||||
pathnode->path.parent = rel;
|
||||
/* pathtarget is not interesting, just make it minimally valid */
|
||||
pathnode->path.pathtarget = &(rel->reltarget);
|
||||
pathnode->path.pathtarget = rel->reltarget;
|
||||
/* For now, assume we are above any joins, so no parameterization */
|
||||
pathnode->path.param_info = NULL;
|
||||
pathnode->path.parallel_aware = false;
|
||||
|
Reference in New Issue
Block a user