mirror of
https://github.com/postgres/postgres.git
synced 2025-07-07 00:36:50 +03:00
Phase 3 of pgindent updates.
Don't move parenthesized lines to the left, even if that means they flow past the right margin. By default, BSD indent lines up statement continuation lines that are within parentheses so that they start just to the right of the preceding left parenthesis. However, traditionally, if that resulted in the continuation line extending to the right of the desired right margin, then indent would push it left just far enough to not overrun the margin, if it could do so without making the continuation line start to the left of the current statement indent. That makes for a weird mix of indentations unless one has been completely rigid about never violating the 80-column limit. This behavior has been pretty universally panned by Postgres developers. Hence, disable it with indent's new -lpl switch, so that parenthesized lines are always lined up with the preceding left paren. This patch is much less interesting than the first round of indent changes, but also bulkier, so I thought it best to separate the effects. Discussion: https://postgr.es/m/E1dAmxK-0006EE-1r@gemulon.postgresql.org Discussion: https://postgr.es/m/30527.1495162840@sss.pgh.pa.us
This commit is contained in:
@ -806,7 +806,7 @@ set_tablesample_rel_pathlist(PlannerInfo *root, RelOptInfo *rel, RangeTblEntry *
|
||||
*/
|
||||
if ((root->query_level > 1 ||
|
||||
bms_membership(root->all_baserels) != BMS_SINGLETON) &&
|
||||
!(GetTsmRoutine(rte->tablesample->tsmhandler)->repeatable_across_scans))
|
||||
!(GetTsmRoutine(rte->tablesample->tsmhandler)->repeatable_across_scans))
|
||||
{
|
||||
path = (Path *) create_material_path(rel, path);
|
||||
}
|
||||
@ -976,7 +976,7 @@ set_append_rel_size(PlannerInfo *root, RelOptInfo *rel,
|
||||
childquals = lappend(childquals,
|
||||
make_restrictinfo((Expr *) onecq,
|
||||
rinfo->is_pushed_down,
|
||||
rinfo->outerjoin_delayed,
|
||||
rinfo->outerjoin_delayed,
|
||||
pseudoconstant,
|
||||
rinfo->security_level,
|
||||
NULL, NULL, NULL));
|
||||
@ -1313,14 +1313,14 @@ add_paths_to_append_rel(PlannerInfo *root, RelOptInfo *rel,
|
||||
*/
|
||||
if (childrel->cheapest_total_path->param_info == NULL)
|
||||
subpaths = accumulate_append_subpath(subpaths,
|
||||
childrel->cheapest_total_path);
|
||||
childrel->cheapest_total_path);
|
||||
else
|
||||
subpaths_valid = false;
|
||||
|
||||
/* Same idea, but for a partial plan. */
|
||||
if (childrel->partial_pathlist != NIL)
|
||||
partial_subpaths = accumulate_append_subpath(partial_subpaths,
|
||||
linitial(childrel->partial_pathlist));
|
||||
linitial(childrel->partial_pathlist));
|
||||
else
|
||||
partial_subpaths_valid = false;
|
||||
|
||||
@ -1580,7 +1580,7 @@ generate_mergeappend_paths(PlannerInfo *root, RelOptInfo *rel,
|
||||
total_subpaths,
|
||||
pathkeys,
|
||||
NULL,
|
||||
partitioned_rels));
|
||||
partitioned_rels));
|
||||
}
|
||||
}
|
||||
|
||||
@ -1922,7 +1922,7 @@ set_subquery_pathlist(PlannerInfo *root, RelOptInfo *rel,
|
||||
pathkeys = convert_subquery_pathkeys(root,
|
||||
rel,
|
||||
subpath->pathkeys,
|
||||
make_tlist_from_pathtarget(subpath->pathtarget));
|
||||
make_tlist_from_pathtarget(subpath->pathtarget));
|
||||
|
||||
/* Generate outer path using this subpath */
|
||||
add_path(rel, (Path *)
|
||||
@ -3048,7 +3048,7 @@ create_partial_bitmap_paths(PlannerInfo *root, RelOptInfo *rel,
|
||||
return;
|
||||
|
||||
add_partial_path(rel, (Path *) create_bitmap_heap_path(root, rel,
|
||||
bitmapqual, rel->lateral_relids, 1.0, parallel_workers));
|
||||
bitmapqual, rel->lateral_relids, 1.0, parallel_workers));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -3086,7 +3086,7 @@ compute_parallel_worker(RelOptInfo *rel, double heap_pages, double index_pages)
|
||||
*/
|
||||
if (rel->reloptkind == RELOPT_BASEREL &&
|
||||
((heap_pages >= 0 && heap_pages < min_parallel_table_scan_size) ||
|
||||
(index_pages >= 0 && index_pages < min_parallel_index_scan_size)))
|
||||
(index_pages >= 0 && index_pages < min_parallel_index_scan_size)))
|
||||
return 0;
|
||||
|
||||
if (heap_pages >= 0)
|
||||
|
@ -690,7 +690,7 @@ clause_selectivity(PlannerInfo *root,
|
||||
{
|
||||
/* inverse of the selectivity of the underlying clause */
|
||||
s1 = 1.0 - clause_selectivity(root,
|
||||
(Node *) get_notclausearg((Expr *) clause),
|
||||
(Node *) get_notclausearg((Expr *) clause),
|
||||
varRelid,
|
||||
jointype,
|
||||
sjinfo);
|
||||
|
@ -504,10 +504,10 @@ cost_index(IndexPath *path, PlannerInfo *root, double loop_count,
|
||||
path->path.rows = path->path.param_info->ppi_rows;
|
||||
/* qpquals come from the rel's restriction clauses and ppi_clauses */
|
||||
qpquals = list_concat(
|
||||
extract_nonindex_conditions(path->indexinfo->indrestrictinfo,
|
||||
path->indexquals),
|
||||
extract_nonindex_conditions(path->path.param_info->ppi_clauses,
|
||||
path->indexquals));
|
||||
extract_nonindex_conditions(path->indexinfo->indrestrictinfo,
|
||||
path->indexquals),
|
||||
extract_nonindex_conditions(path->path.param_info->ppi_clauses,
|
||||
path->indexquals));
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -677,7 +677,7 @@ cost_index(IndexPath *path, PlannerInfo *root, double loop_count,
|
||||
* order.
|
||||
*/
|
||||
path->path.parallel_workers = compute_parallel_worker(baserel,
|
||||
rand_heap_pages, index_pages);
|
||||
rand_heap_pages, index_pages);
|
||||
|
||||
/*
|
||||
* Fall out if workers can't be assigned for parallel scan, because in
|
||||
@ -3097,7 +3097,7 @@ final_cost_hashjoin(PlannerInfo *root, HashPath *path,
|
||||
/* not cached yet */
|
||||
thisbucketsize =
|
||||
estimate_hash_bucketsize(root,
|
||||
get_rightop(restrictinfo->clause),
|
||||
get_rightop(restrictinfo->clause),
|
||||
virtualbuckets);
|
||||
restrictinfo->right_bucketsize = thisbucketsize;
|
||||
}
|
||||
@ -3113,7 +3113,7 @@ final_cost_hashjoin(PlannerInfo *root, HashPath *path,
|
||||
/* not cached yet */
|
||||
thisbucketsize =
|
||||
estimate_hash_bucketsize(root,
|
||||
get_leftop(restrictinfo->clause),
|
||||
get_leftop(restrictinfo->clause),
|
||||
virtualbuckets);
|
||||
restrictinfo->left_bucketsize = thisbucketsize;
|
||||
}
|
||||
@ -3376,7 +3376,7 @@ cost_rescan(PlannerInfo *root, Path *path,
|
||||
*/
|
||||
Cost run_cost = cpu_tuple_cost * path->rows;
|
||||
double nbytes = relation_byte_size(path->rows,
|
||||
path->pathtarget->width);
|
||||
path->pathtarget->width);
|
||||
long work_mem_bytes = work_mem * 1024L;
|
||||
|
||||
if (nbytes > work_mem_bytes)
|
||||
@ -3403,7 +3403,7 @@ cost_rescan(PlannerInfo *root, Path *path,
|
||||
*/
|
||||
Cost run_cost = cpu_operator_cost * path->rows;
|
||||
double nbytes = relation_byte_size(path->rows,
|
||||
path->pathtarget->width);
|
||||
path->pathtarget->width);
|
||||
long work_mem_bytes = work_mem * 1024L;
|
||||
|
||||
if (nbytes > work_mem_bytes)
|
||||
@ -3785,7 +3785,7 @@ compute_semi_anti_join_factors(PlannerInfo *root,
|
||||
jselec = clauselist_selectivity(root,
|
||||
joinquals,
|
||||
0,
|
||||
(jointype == JOIN_ANTI) ? JOIN_ANTI : JOIN_SEMI,
|
||||
(jointype == JOIN_ANTI) ? JOIN_ANTI : JOIN_SEMI,
|
||||
sjinfo);
|
||||
|
||||
/*
|
||||
@ -4925,7 +4925,7 @@ set_rel_width(PlannerInfo *root, RelOptInfo *rel)
|
||||
{
|
||||
/* Real relation, so estimate true tuple width */
|
||||
wholerow_width += get_relation_data_width(reloid,
|
||||
rel->attr_widths - rel->min_attr);
|
||||
rel->attr_widths - rel->min_attr);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1103,9 +1103,9 @@ generate_join_implied_equalities_for_ecs(PlannerInfo *root,
|
||||
if (ec->ec_broken)
|
||||
sublist = generate_join_implied_equalities_broken(root,
|
||||
ec,
|
||||
nominal_join_relids,
|
||||
nominal_join_relids,
|
||||
outer_relids,
|
||||
nominal_inner_relids,
|
||||
nominal_inner_relids,
|
||||
inner_rel);
|
||||
|
||||
result = list_concat(result, sublist);
|
||||
@ -1426,7 +1426,7 @@ create_join_clause(PlannerInfo *root,
|
||||
bms_union(leftem->em_relids,
|
||||
rightem->em_relids),
|
||||
bms_union(leftem->em_nullable_relids,
|
||||
rightem->em_nullable_relids),
|
||||
rightem->em_nullable_relids),
|
||||
ec->ec_min_security);
|
||||
|
||||
/* Mark the clause as redundant, or not */
|
||||
@ -1738,7 +1738,7 @@ reconsider_outer_join_clause(PlannerInfo *root, RestrictInfo *rinfo,
|
||||
innervar,
|
||||
cur_em->em_expr,
|
||||
bms_copy(inner_relids),
|
||||
bms_copy(inner_nullable_relids),
|
||||
bms_copy(inner_nullable_relids),
|
||||
cur_ec->ec_min_security);
|
||||
if (process_equivalence(root, newrinfo, true))
|
||||
match = true;
|
||||
@ -1881,8 +1881,8 @@ reconsider_full_join_clause(PlannerInfo *root, RestrictInfo *rinfo)
|
||||
leftvar,
|
||||
cur_em->em_expr,
|
||||
bms_copy(left_relids),
|
||||
bms_copy(left_nullable_relids),
|
||||
cur_ec->ec_min_security);
|
||||
bms_copy(left_nullable_relids),
|
||||
cur_ec->ec_min_security);
|
||||
if (process_equivalence(root, newrinfo, true))
|
||||
matchleft = true;
|
||||
}
|
||||
@ -1896,8 +1896,8 @@ reconsider_full_join_clause(PlannerInfo *root, RestrictInfo *rinfo)
|
||||
rightvar,
|
||||
cur_em->em_expr,
|
||||
bms_copy(right_relids),
|
||||
bms_copy(right_nullable_relids),
|
||||
cur_ec->ec_min_security);
|
||||
bms_copy(right_nullable_relids),
|
||||
cur_ec->ec_min_security);
|
||||
if (process_equivalence(root, newrinfo, true))
|
||||
matchright = true;
|
||||
}
|
||||
|
@ -320,7 +320,7 @@ create_index_paths(PlannerInfo *root, RelOptInfo *rel)
|
||||
* the joinclause list. Add these to bitjoinpaths.
|
||||
*/
|
||||
indexpaths = generate_bitmap_or_paths(root, rel,
|
||||
joinorclauses, rel->baserestrictinfo);
|
||||
joinorclauses, rel->baserestrictinfo);
|
||||
bitjoinpaths = list_concat(bitjoinpaths, indexpaths);
|
||||
|
||||
/*
|
||||
@ -1760,7 +1760,7 @@ get_bitmap_tree_required_outer(Path *bitmapqual)
|
||||
foreach(lc, ((BitmapAndPath *) bitmapqual)->bitmapquals)
|
||||
{
|
||||
result = bms_join(result,
|
||||
get_bitmap_tree_required_outer((Path *) lfirst(lc)));
|
||||
get_bitmap_tree_required_outer((Path *) lfirst(lc)));
|
||||
}
|
||||
}
|
||||
else if (IsA(bitmapqual, BitmapOrPath))
|
||||
@ -1768,7 +1768,7 @@ get_bitmap_tree_required_outer(Path *bitmapqual)
|
||||
foreach(lc, ((BitmapOrPath *) bitmapqual)->bitmapquals)
|
||||
{
|
||||
result = bms_join(result,
|
||||
get_bitmap_tree_required_outer((Path *) lfirst(lc)));
|
||||
get_bitmap_tree_required_outer((Path *) lfirst(lc)));
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -2161,9 +2161,9 @@ match_eclass_clauses_to_index(PlannerInfo *root, IndexOptInfo *index,
|
||||
arg.indexcol = indexcol;
|
||||
clauses = generate_implied_equalities_for_column(root,
|
||||
index->rel,
|
||||
ec_member_matches_indexcol,
|
||||
ec_member_matches_indexcol,
|
||||
(void *) &arg,
|
||||
index->rel->lateral_referencers);
|
||||
index->rel->lateral_referencers);
|
||||
|
||||
/*
|
||||
* We have to check whether the results actually do match the index,
|
||||
@ -2836,8 +2836,8 @@ check_index_predicates(PlannerInfo *root, RelOptInfo *rel)
|
||||
clauselist =
|
||||
list_concat(clauselist,
|
||||
generate_join_implied_equalities(root,
|
||||
bms_union(rel->relids,
|
||||
otherrels),
|
||||
bms_union(rel->relids,
|
||||
otherrels),
|
||||
otherrels,
|
||||
rel));
|
||||
|
||||
@ -4085,7 +4085,7 @@ prefix_quals(Node *leftop, Oid opfamily, Oid collation,
|
||||
break;
|
||||
case BYTEAOID:
|
||||
prefix = DatumGetCString(DirectFunctionCall1(byteaout,
|
||||
prefix_const->constvalue));
|
||||
prefix_const->constvalue));
|
||||
break;
|
||||
default:
|
||||
elog(ERROR, "unexpected const type: %u",
|
||||
|
@ -214,16 +214,16 @@ add_paths_to_joinrel(PlannerInfo *root,
|
||||
if (bms_overlap(joinrel->relids, sjinfo2->min_righthand) &&
|
||||
!bms_overlap(joinrel->relids, sjinfo2->min_lefthand))
|
||||
extra.param_source_rels = bms_join(extra.param_source_rels,
|
||||
bms_difference(root->all_baserels,
|
||||
sjinfo2->min_righthand));
|
||||
bms_difference(root->all_baserels,
|
||||
sjinfo2->min_righthand));
|
||||
|
||||
/* full joins constrain both sides symmetrically */
|
||||
if (sjinfo2->jointype == JOIN_FULL &&
|
||||
bms_overlap(joinrel->relids, sjinfo2->min_lefthand) &&
|
||||
!bms_overlap(joinrel->relids, sjinfo2->min_righthand))
|
||||
extra.param_source_rels = bms_join(extra.param_source_rels,
|
||||
bms_difference(root->all_baserels,
|
||||
sjinfo2->min_lefthand));
|
||||
bms_difference(root->all_baserels,
|
||||
sjinfo2->min_lefthand));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -918,7 +918,7 @@ sort_inner_and_outer(PlannerInfo *root,
|
||||
cur_mergeclauses = find_mergeclauses_for_pathkeys(root,
|
||||
outerkeys,
|
||||
true,
|
||||
extra->mergeclause_list);
|
||||
extra->mergeclause_list);
|
||||
|
||||
/* Should have used them all... */
|
||||
Assert(list_length(cur_mergeclauses) == list_length(extra->mergeclause_list));
|
||||
@ -1445,7 +1445,7 @@ match_unsorted_outer(PlannerInfo *root,
|
||||
return;
|
||||
|
||||
inner_cheapest_total = get_cheapest_parallel_safe_total_inner(
|
||||
innerrel->pathlist);
|
||||
innerrel->pathlist);
|
||||
}
|
||||
|
||||
if (inner_cheapest_total)
|
||||
|
@ -615,7 +615,7 @@ join_is_legal(PlannerInfo *root, RelOptInfo *rel1, RelOptInfo *rel2,
|
||||
!bms_is_subset(sjinfo->min_righthand, join_plus_rhs))
|
||||
{
|
||||
join_plus_rhs = bms_add_members(join_plus_rhs,
|
||||
sjinfo->min_righthand);
|
||||
sjinfo->min_righthand);
|
||||
more = true;
|
||||
}
|
||||
/* full joins constrain both sides symmetrically */
|
||||
|
@ -575,8 +575,8 @@ build_expression_pathkey(PlannerInfo *root,
|
||||
opfamily,
|
||||
opcintype,
|
||||
exprCollation((Node *) expr),
|
||||
(strategy == BTGreaterStrategyNumber),
|
||||
(strategy == BTGreaterStrategyNumber),
|
||||
(strategy == BTGreaterStrategyNumber),
|
||||
(strategy == BTGreaterStrategyNumber),
|
||||
0,
|
||||
rel,
|
||||
create_it);
|
||||
@ -746,7 +746,7 @@ convert_subquery_pathkeys(PlannerInfo *root, RelOptInfo *rel,
|
||||
outer_ec = get_eclass_for_sort_expr(root,
|
||||
outer_expr,
|
||||
NULL,
|
||||
sub_eclass->ec_opfamilies,
|
||||
sub_eclass->ec_opfamilies,
|
||||
sub_expr_type,
|
||||
sub_expr_coll,
|
||||
0,
|
||||
@ -762,9 +762,9 @@ convert_subquery_pathkeys(PlannerInfo *root, RelOptInfo *rel,
|
||||
|
||||
outer_pk = make_canonical_pathkey(root,
|
||||
outer_ec,
|
||||
sub_pathkey->pk_opfamily,
|
||||
sub_pathkey->pk_strategy,
|
||||
sub_pathkey->pk_nulls_first);
|
||||
sub_pathkey->pk_opfamily,
|
||||
sub_pathkey->pk_strategy,
|
||||
sub_pathkey->pk_nulls_first);
|
||||
/* score = # of equivalence peers */
|
||||
score = list_length(outer_ec->ec_members) - 1;
|
||||
/* +1 if it matches the proper query_pathkeys item */
|
||||
|
@ -140,7 +140,7 @@ static TableFuncScan *create_tablefuncscan_plan(PlannerInfo *root, Path *best_pa
|
||||
static CteScan *create_ctescan_plan(PlannerInfo *root, Path *best_path,
|
||||
List *tlist, List *scan_clauses);
|
||||
static NamedTuplestoreScan *create_namedtuplestorescan_plan(PlannerInfo *root,
|
||||
Path *best_path, List *tlist, List *scan_clauses);
|
||||
Path *best_path, List *tlist, List *scan_clauses);
|
||||
static WorkTableScan *create_worktablescan_plan(PlannerInfo *root, Path *best_path,
|
||||
List *tlist, List *scan_clauses);
|
||||
static ForeignScan *create_foreignscan_plan(PlannerInfo *root, ForeignPath *best_path,
|
||||
@ -397,7 +397,7 @@ create_plan_recurse(PlannerInfo *root, Path *best_path, int flags)
|
||||
else if (IsA(best_path, MinMaxAggPath))
|
||||
{
|
||||
plan = (Plan *) create_minmaxagg_plan(root,
|
||||
(MinMaxAggPath *) best_path);
|
||||
(MinMaxAggPath *) best_path);
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -408,7 +408,7 @@ create_plan_recurse(PlannerInfo *root, Path *best_path, int flags)
|
||||
break;
|
||||
case T_ProjectSet:
|
||||
plan = (Plan *) create_project_set_plan(root,
|
||||
(ProjectSetPath *) best_path);
|
||||
(ProjectSetPath *) best_path);
|
||||
break;
|
||||
case T_Material:
|
||||
plan = (Plan *) create_material_plan(root,
|
||||
@ -419,7 +419,7 @@ create_plan_recurse(PlannerInfo *root, Path *best_path, int flags)
|
||||
if (IsA(best_path, UpperUniquePath))
|
||||
{
|
||||
plan = (Plan *) create_upper_unique_plan(root,
|
||||
(UpperUniquePath *) best_path,
|
||||
(UpperUniquePath *) best_path,
|
||||
flags);
|
||||
}
|
||||
else
|
||||
@ -446,7 +446,7 @@ create_plan_recurse(PlannerInfo *root, Path *best_path, int flags)
|
||||
case T_Agg:
|
||||
if (IsA(best_path, GroupingSetsPath))
|
||||
plan = create_groupingsets_plan(root,
|
||||
(GroupingSetsPath *) best_path);
|
||||
(GroupingSetsPath *) best_path);
|
||||
else
|
||||
{
|
||||
Assert(IsA(best_path, AggPath));
|
||||
@ -456,7 +456,7 @@ create_plan_recurse(PlannerInfo *root, Path *best_path, int flags)
|
||||
break;
|
||||
case T_WindowAgg:
|
||||
plan = (Plan *) create_windowagg_plan(root,
|
||||
(WindowAggPath *) best_path);
|
||||
(WindowAggPath *) best_path);
|
||||
break;
|
||||
case T_SetOp:
|
||||
plan = (Plan *) create_setop_plan(root,
|
||||
@ -465,7 +465,7 @@ create_plan_recurse(PlannerInfo *root, Path *best_path, int flags)
|
||||
break;
|
||||
case T_RecursiveUnion:
|
||||
plan = (Plan *) create_recursiveunion_plan(root,
|
||||
(RecursiveUnionPath *) best_path);
|
||||
(RecursiveUnionPath *) best_path);
|
||||
break;
|
||||
case T_LockRows:
|
||||
plan = (Plan *) create_lockrows_plan(root,
|
||||
@ -474,7 +474,7 @@ create_plan_recurse(PlannerInfo *root, Path *best_path, int flags)
|
||||
break;
|
||||
case T_ModifyTable:
|
||||
plan = (Plan *) create_modifytable_plan(root,
|
||||
(ModifyTablePath *) best_path);
|
||||
(ModifyTablePath *) best_path);
|
||||
break;
|
||||
case T_Limit:
|
||||
plan = (Plan *) create_limit_plan(root,
|
||||
@ -483,7 +483,7 @@ create_plan_recurse(PlannerInfo *root, Path *best_path, int flags)
|
||||
break;
|
||||
case T_GatherMerge:
|
||||
plan = (Plan *) create_gather_merge_plan(root,
|
||||
(GatherMergePath *) best_path);
|
||||
(GatherMergePath *) best_path);
|
||||
break;
|
||||
default:
|
||||
elog(ERROR, "unrecognized node type: %d",
|
||||
@ -625,7 +625,7 @@ create_scan_plan(PlannerInfo *root, Path *best_path, int flags)
|
||||
|
||||
case T_BitmapHeapScan:
|
||||
plan = (Plan *) create_bitmap_scan_plan(root,
|
||||
(BitmapHeapPath *) best_path,
|
||||
(BitmapHeapPath *) best_path,
|
||||
tlist,
|
||||
scan_clauses);
|
||||
break;
|
||||
@ -639,7 +639,7 @@ create_scan_plan(PlannerInfo *root, Path *best_path, int flags)
|
||||
|
||||
case T_SubqueryScan:
|
||||
plan = (Plan *) create_subqueryscan_plan(root,
|
||||
(SubqueryScanPath *) best_path,
|
||||
(SubqueryScanPath *) best_path,
|
||||
tlist,
|
||||
scan_clauses);
|
||||
break;
|
||||
@ -985,7 +985,7 @@ create_join_plan(PlannerInfo *root, JoinPath *best_path)
|
||||
if (get_loc_restrictinfo(best_path) != NIL)
|
||||
set_qpqual((Plan) plan,
|
||||
list_concat(get_qpqual((Plan) plan),
|
||||
get_actual_clauses(get_loc_restrictinfo(best_path))));
|
||||
get_actual_clauses(get_loc_restrictinfo(best_path))));
|
||||
#endif
|
||||
|
||||
return plan;
|
||||
@ -1909,9 +1909,9 @@ create_groupingsets_plan(PlannerInfo *root, GroupingSetsPath *best_path)
|
||||
NIL,
|
||||
strat,
|
||||
AGGSPLIT_SIMPLE,
|
||||
list_length((List *) linitial(rollup->gsets)),
|
||||
list_length((List *) linitial(rollup->gsets)),
|
||||
new_grpColIdx,
|
||||
extract_grouping_ops(rollup->groupClause),
|
||||
extract_grouping_ops(rollup->groupClause),
|
||||
rollup->gsets,
|
||||
NIL,
|
||||
rollup->numGroups,
|
||||
@ -2576,7 +2576,7 @@ create_indexscan_plan(PlannerInfo *root,
|
||||
if (is_redundant_derived_clause(rinfo, indexquals))
|
||||
continue; /* derived from same EquivalenceClass */
|
||||
if (!contain_mutable_functions((Node *) rinfo->clause) &&
|
||||
predicate_implied_by(list_make1(rinfo->clause), indexquals, false))
|
||||
predicate_implied_by(list_make1(rinfo->clause), indexquals, false))
|
||||
continue; /* provably implied by indexquals */
|
||||
qpqual = lappend(qpqual, rinfo);
|
||||
}
|
||||
@ -2647,7 +2647,7 @@ create_indexscan_plan(PlannerInfo *root,
|
||||
indexoid,
|
||||
fixed_indexquals,
|
||||
fixed_indexorderbys,
|
||||
best_path->indexinfo->indextlist,
|
||||
best_path->indexinfo->indextlist,
|
||||
best_path->indexscandir);
|
||||
else
|
||||
scan_plan = (Scan *) make_indexscan(tlist,
|
||||
@ -3718,7 +3718,7 @@ create_nestloop_plan(PlannerInfo *root,
|
||||
bms_overlap(((PlaceHolderVar *) nlp->paramval)->phrels,
|
||||
outerrelids) &&
|
||||
bms_is_subset(find_placeholder_info(root,
|
||||
(PlaceHolderVar *) nlp->paramval,
|
||||
(PlaceHolderVar *) nlp->paramval,
|
||||
false)->ph_eval_at,
|
||||
outerrelids))
|
||||
{
|
||||
@ -3774,10 +3774,10 @@ create_mergejoin_plan(PlannerInfo *root,
|
||||
* necessary.
|
||||
*/
|
||||
outer_plan = create_plan_recurse(root, best_path->jpath.outerjoinpath,
|
||||
(best_path->outersortkeys != NIL) ? CP_SMALL_TLIST : 0);
|
||||
(best_path->outersortkeys != NIL) ? CP_SMALL_TLIST : 0);
|
||||
|
||||
inner_plan = create_plan_recurse(root, best_path->jpath.innerjoinpath,
|
||||
(best_path->innersortkeys != NIL) ? CP_SMALL_TLIST : 0);
|
||||
(best_path->innersortkeys != NIL) ? CP_SMALL_TLIST : 0);
|
||||
|
||||
/* Sort join qual clauses into best execution order */
|
||||
/* NB: do NOT reorder the mergeclauses */
|
||||
@ -3822,7 +3822,7 @@ create_mergejoin_plan(PlannerInfo *root,
|
||||
* outer_is_left status.
|
||||
*/
|
||||
mergeclauses = get_switched_clauses(best_path->path_mergeclauses,
|
||||
best_path->jpath.outerjoinpath->parent->relids);
|
||||
best_path->jpath.outerjoinpath->parent->relids);
|
||||
|
||||
/*
|
||||
* Create explicit sort nodes for the outer and inner paths if necessary.
|
||||
@ -4073,7 +4073,7 @@ create_hashjoin_plan(PlannerInfo *root,
|
||||
* that we don't put extra data in the outer batch files.
|
||||
*/
|
||||
outer_plan = create_plan_recurse(root, best_path->jpath.outerjoinpath,
|
||||
(best_path->num_batches > 1) ? CP_SMALL_TLIST : 0);
|
||||
(best_path->num_batches > 1) ? CP_SMALL_TLIST : 0);
|
||||
|
||||
inner_plan = create_plan_recurse(root, best_path->jpath.innerjoinpath,
|
||||
CP_SMALL_TLIST);
|
||||
@ -4120,7 +4120,7 @@ create_hashjoin_plan(PlannerInfo *root,
|
||||
* on the left.
|
||||
*/
|
||||
hashclauses = get_switched_clauses(best_path->path_hashclauses,
|
||||
best_path->jpath.outerjoinpath->parent->relids);
|
||||
best_path->jpath.outerjoinpath->parent->relids);
|
||||
|
||||
/*
|
||||
* If there is a single join clause and we can identify the outer variable
|
||||
@ -4260,8 +4260,8 @@ replace_nestloop_params_mutator(Node *node, PlannerInfo *root)
|
||||
* rels, and then grab its PlaceHolderInfo to tell for sure.
|
||||
*/
|
||||
if (!bms_overlap(phv->phrels, root->curOuterRels) ||
|
||||
!bms_is_subset(find_placeholder_info(root, phv, false)->ph_eval_at,
|
||||
root->curOuterRels))
|
||||
!bms_is_subset(find_placeholder_info(root, phv, false)->ph_eval_at,
|
||||
root->curOuterRels))
|
||||
{
|
||||
/*
|
||||
* We can't replace the whole PHV, but we might still need to
|
||||
@ -4919,7 +4919,7 @@ bitmap_subplan_mark_shared(Plan *plan)
|
||||
{
|
||||
if (IsA(plan, BitmapAnd))
|
||||
bitmap_subplan_mark_shared(
|
||||
linitial(((BitmapAnd *) plan)->bitmapplans));
|
||||
linitial(((BitmapAnd *) plan)->bitmapplans));
|
||||
else if (IsA(plan, BitmapOr))
|
||||
((BitmapOr *) plan)->isshared = true;
|
||||
else if (IsA(plan, BitmapIndexScan))
|
||||
|
@ -2223,7 +2223,7 @@ distribute_restrictinfo_to_rels(PlannerInfo *root,
|
||||
restrictinfo);
|
||||
/* Update security level info */
|
||||
rel->baserestrict_min_security = Min(rel->baserestrict_min_security,
|
||||
restrictinfo->security_level);
|
||||
restrictinfo->security_level);
|
||||
break;
|
||||
case BMS_MULTIPLE:
|
||||
|
||||
|
@ -203,7 +203,7 @@ preprocess_minmax_aggregates(PlannerInfo *root, List *tlist)
|
||||
SS_make_initplan_output_param(root,
|
||||
exprType((Node *) mminfo->target),
|
||||
-1,
|
||||
exprCollation((Node *) mminfo->target));
|
||||
exprCollation((Node *) mminfo->target));
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -1311,7 +1311,7 @@ inheritance_planner(PlannerInfo *root)
|
||||
else
|
||||
final_rtable = list_concat(final_rtable,
|
||||
list_copy_tail(subroot->parse->rtable,
|
||||
list_length(final_rtable)));
|
||||
list_length(final_rtable)));
|
||||
|
||||
/*
|
||||
* We need to collect all the RelOptInfos from all child plans into
|
||||
@ -1543,7 +1543,7 @@ grouping_planner(PlannerInfo *root, bool inheritance_update,
|
||||
translator: %s is a SQL row locking clause such as FOR UPDATE */
|
||||
errmsg("%s is not allowed with UNION/INTERSECT/EXCEPT",
|
||||
LCS_asString(((RowMarkClause *)
|
||||
linitial(parse->rowMarks))->strength))));
|
||||
linitial(parse->rowMarks))->strength))));
|
||||
|
||||
/*
|
||||
* Calculate pathkeys that represent result ordering requirements
|
||||
@ -1978,7 +1978,7 @@ grouping_planner(PlannerInfo *root, bool inheritance_update,
|
||||
{
|
||||
path = (Path *) create_lockrows_path(root, final_rel, path,
|
||||
root->rowMarks,
|
||||
SS_assign_special_param(root));
|
||||
SS_assign_special_param(root));
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2233,7 +2233,7 @@ preprocess_grouping_sets(PlannerInfo *root)
|
||||
*/
|
||||
gd->hash_sets_idx = remap_to_groupclause_idx(parse->groupClause,
|
||||
gd->unsortable_sets,
|
||||
gd->tleref_to_colnum_map);
|
||||
gd->tleref_to_colnum_map);
|
||||
gd->any_hashable = true;
|
||||
}
|
||||
|
||||
@ -2778,7 +2778,7 @@ remove_useless_groupby_columns(PlannerInfo *root)
|
||||
relid = var->varno;
|
||||
Assert(relid <= list_length(parse->rtable));
|
||||
groupbyattnos[relid] = bms_add_member(groupbyattnos[relid],
|
||||
var->varattno - FirstLowInvalidHeapAttributeNumber);
|
||||
var->varattno - FirstLowInvalidHeapAttributeNumber);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -2827,7 +2827,7 @@ remove_useless_groupby_columns(PlannerInfo *root)
|
||||
*/
|
||||
if (surplusvars == NULL)
|
||||
surplusvars = (Bitmapset **) palloc0(sizeof(Bitmapset *) *
|
||||
(list_length(parse->rtable) + 1));
|
||||
(list_length(parse->rtable) + 1));
|
||||
|
||||
/* Remember the attnos of the removable columns */
|
||||
surplusvars[relid] = bms_difference(relattnos, pkattnos);
|
||||
@ -2859,8 +2859,8 @@ remove_useless_groupby_columns(PlannerInfo *root)
|
||||
*/
|
||||
if (!IsA(var, Var) ||
|
||||
var->varlevelsup > 0 ||
|
||||
!bms_is_member(var->varattno - FirstLowInvalidHeapAttributeNumber,
|
||||
surplusvars[var->varno]))
|
||||
!bms_is_member(var->varattno - FirstLowInvalidHeapAttributeNumber,
|
||||
surplusvars[var->varno]))
|
||||
new_groupby = lappend(new_groupby, sgc);
|
||||
}
|
||||
|
||||
@ -3653,7 +3653,7 @@ create_grouping_paths(PlannerInfo *root,
|
||||
*/
|
||||
can_hash = (parse->groupClause != NIL &&
|
||||
agg_costs->numOrderedAggs == 0 &&
|
||||
(gd ? gd->any_hashable : grouping_is_hashable(parse->groupClause)));
|
||||
(gd ? gd->any_hashable : grouping_is_hashable(parse->groupClause)));
|
||||
|
||||
/*
|
||||
* If grouped_rel->consider_parallel is true, then paths that we generate
|
||||
@ -3774,9 +3774,9 @@ create_grouping_paths(PlannerInfo *root,
|
||||
create_agg_path(root,
|
||||
grouped_rel,
|
||||
path,
|
||||
partial_grouping_target,
|
||||
parse->groupClause ? AGG_SORTED : AGG_PLAIN,
|
||||
AGGSPLIT_INITIAL_SERIAL,
|
||||
partial_grouping_target,
|
||||
parse->groupClause ? AGG_SORTED : AGG_PLAIN,
|
||||
AGGSPLIT_INITIAL_SERIAL,
|
||||
parse->groupClause,
|
||||
NIL,
|
||||
&agg_partial_costs,
|
||||
@ -3786,10 +3786,10 @@ create_grouping_paths(PlannerInfo *root,
|
||||
create_group_path(root,
|
||||
grouped_rel,
|
||||
path,
|
||||
partial_grouping_target,
|
||||
partial_grouping_target,
|
||||
parse->groupClause,
|
||||
NIL,
|
||||
dNumPartialGroups));
|
||||
dNumPartialGroups));
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -3867,7 +3867,7 @@ create_grouping_paths(PlannerInfo *root,
|
||||
grouped_rel,
|
||||
path,
|
||||
target,
|
||||
parse->groupClause ? AGG_SORTED : AGG_PLAIN,
|
||||
parse->groupClause ? AGG_SORTED : AGG_PLAIN,
|
||||
AGGSPLIT_SIMPLE,
|
||||
parse->groupClause,
|
||||
(List *) parse->havingQual,
|
||||
@ -3931,7 +3931,7 @@ create_grouping_paths(PlannerInfo *root,
|
||||
grouped_rel,
|
||||
path,
|
||||
target,
|
||||
parse->groupClause ? AGG_SORTED : AGG_PLAIN,
|
||||
parse->groupClause ? AGG_SORTED : AGG_PLAIN,
|
||||
AGGSPLIT_FINAL_DESERIAL,
|
||||
parse->groupClause,
|
||||
(List *) parse->havingQual,
|
||||
@ -3993,7 +3993,7 @@ create_grouping_paths(PlannerInfo *root,
|
||||
grouped_rel,
|
||||
gmpath,
|
||||
target,
|
||||
parse->groupClause ? AGG_SORTED : AGG_PLAIN,
|
||||
parse->groupClause ? AGG_SORTED : AGG_PLAIN,
|
||||
AGGSPLIT_FINAL_DESERIAL,
|
||||
parse->groupClause,
|
||||
(List *) parse->havingQual,
|
||||
@ -4243,7 +4243,7 @@ consider_groupingsets_paths(PlannerInfo *root,
|
||||
rollup->gsets_data = list_make1(gs);
|
||||
rollup->gsets = remap_to_groupclause_idx(rollup->groupClause,
|
||||
rollup->gsets_data,
|
||||
gd->tleref_to_colnum_map);
|
||||
gd->tleref_to_colnum_map);
|
||||
rollup->numGroups = gs->numGroups;
|
||||
rollup->hashable = true;
|
||||
rollup->is_hashed = true;
|
||||
@ -4373,7 +4373,7 @@ consider_groupingsets_paths(PlannerInfo *root,
|
||||
{
|
||||
double sz = estimate_hashagg_tablesize(path,
|
||||
agg_costs,
|
||||
rollup->numGroups);
|
||||
rollup->numGroups);
|
||||
|
||||
/*
|
||||
* If sz is enormous, but work_mem (and hence scale) is
|
||||
@ -4407,7 +4407,7 @@ consider_groupingsets_paths(PlannerInfo *root,
|
||||
{
|
||||
if (bms_is_member(i, hash_items))
|
||||
hash_sets = list_concat(hash_sets,
|
||||
list_copy(rollup->gsets_data));
|
||||
list_copy(rollup->gsets_data));
|
||||
else
|
||||
rollups = lappend(rollups, rollup);
|
||||
++i;
|
||||
@ -4432,7 +4432,7 @@ consider_groupingsets_paths(PlannerInfo *root,
|
||||
rollup->gsets_data = list_make1(gs);
|
||||
rollup->gsets = remap_to_groupclause_idx(rollup->groupClause,
|
||||
rollup->gsets_data,
|
||||
gd->tleref_to_colnum_map);
|
||||
gd->tleref_to_colnum_map);
|
||||
rollup->numGroups = gs->numGroups;
|
||||
rollup->hashable = true;
|
||||
rollup->is_hashed = true;
|
||||
@ -4757,7 +4757,7 @@ create_distinct_paths(PlannerInfo *root,
|
||||
add_path(distinct_rel, (Path *)
|
||||
create_upper_unique_path(root, distinct_rel,
|
||||
path,
|
||||
list_length(root->distinct_pathkeys),
|
||||
list_length(root->distinct_pathkeys),
|
||||
numDistinctRows));
|
||||
}
|
||||
}
|
||||
@ -4784,7 +4784,7 @@ create_distinct_paths(PlannerInfo *root,
|
||||
add_path(distinct_rel, (Path *)
|
||||
create_upper_unique_path(root, distinct_rel,
|
||||
path,
|
||||
list_length(root->distinct_pathkeys),
|
||||
list_length(root->distinct_pathkeys),
|
||||
numDistinctRows));
|
||||
}
|
||||
|
||||
@ -4849,7 +4849,7 @@ create_distinct_paths(PlannerInfo *root,
|
||||
if (distinct_rel->fdwroutine &&
|
||||
distinct_rel->fdwroutine->GetForeignUpperPaths)
|
||||
distinct_rel->fdwroutine->GetForeignUpperPaths(root, UPPERREL_DISTINCT,
|
||||
input_rel, distinct_rel);
|
||||
input_rel, distinct_rel);
|
||||
|
||||
/* Let extensions possibly add some more paths */
|
||||
if (create_upper_paths_hook)
|
||||
@ -5525,7 +5525,7 @@ make_pathkeys_for_window(PlannerInfo *root, WindowClause *wc,
|
||||
ereport(ERROR,
|
||||
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
|
||||
errmsg("could not implement window ORDER BY"),
|
||||
errdetail("Window ordering columns must be of sortable datatypes.")));
|
||||
errdetail("Window ordering columns must be of sortable datatypes.")));
|
||||
|
||||
/* Okay, make the combined pathkeys */
|
||||
window_sortclauses = list_concat(list_copy(wc->partitionClause),
|
||||
@ -5739,7 +5739,7 @@ make_sort_input_target(PlannerInfo *root,
|
||||
postponable_cols = lappend(postponable_cols, expr);
|
||||
else
|
||||
add_column_to_pathtarget(input_target, expr,
|
||||
get_pathtarget_sortgroupref(final_target, i));
|
||||
get_pathtarget_sortgroupref(final_target, i));
|
||||
|
||||
i++;
|
||||
}
|
||||
@ -5793,7 +5793,7 @@ get_cheapest_fractional_path(RelOptInfo *rel, double tuple_fraction)
|
||||
Path *path = (Path *) lfirst(l);
|
||||
|
||||
if (path == rel->cheapest_total_path ||
|
||||
compare_fractional_path_costs(best_path, path, tuple_fraction) <= 0)
|
||||
compare_fractional_path_costs(best_path, path, tuple_fraction) <= 0)
|
||||
continue;
|
||||
|
||||
best_path = path;
|
||||
|
@ -1393,13 +1393,13 @@ fix_expr_common(PlannerInfo *root, Node *node)
|
||||
{
|
||||
set_sa_opfuncid((ScalarArrayOpExpr *) node);
|
||||
record_plan_function_dependency(root,
|
||||
((ScalarArrayOpExpr *) node)->opfuncid);
|
||||
((ScalarArrayOpExpr *) node)->opfuncid);
|
||||
}
|
||||
else if (IsA(node, ArrayCoerceExpr))
|
||||
{
|
||||
if (OidIsValid(((ArrayCoerceExpr *) node)->elemfuncid))
|
||||
record_plan_function_dependency(root,
|
||||
((ArrayCoerceExpr *) node)->elemfuncid);
|
||||
((ArrayCoerceExpr *) node)->elemfuncid);
|
||||
}
|
||||
else if (IsA(node, Const))
|
||||
{
|
||||
@ -2514,7 +2514,7 @@ record_plan_function_dependency(PlannerInfo *root, Oid funcid)
|
||||
*/
|
||||
inval_item->cacheId = PROCOID;
|
||||
inval_item->hashValue = GetSysCacheHashValue1(PROCOID,
|
||||
ObjectIdGetDatum(funcid));
|
||||
ObjectIdGetDatum(funcid));
|
||||
|
||||
root->glob->invalItems = lappend(root->glob->invalItems, inval_item);
|
||||
}
|
||||
|
@ -1915,7 +1915,7 @@ replace_correlation_vars_mutator(Node *node, PlannerInfo *root)
|
||||
{
|
||||
if (((PlaceHolderVar *) node)->phlevelsup > 0)
|
||||
return (Node *) replace_outer_placeholdervar(root,
|
||||
(PlaceHolderVar *) node);
|
||||
(PlaceHolderVar *) node);
|
||||
}
|
||||
if (IsA(node, Aggref))
|
||||
{
|
||||
|
@ -269,7 +269,7 @@ pull_up_sublinks_jointree_recurse(PlannerInfo *root, Node *jtnode,
|
||||
j->quals = pull_up_sublinks_qual_recurse(root, j->quals,
|
||||
&jtlink,
|
||||
bms_union(leftrelids,
|
||||
rightrelids),
|
||||
rightrelids),
|
||||
NULL, NULL);
|
||||
break;
|
||||
case JOIN_LEFT:
|
||||
@ -464,7 +464,7 @@ pull_up_sublinks_qual_recurse(PlannerInfo *root, Node *node,
|
||||
if (sublink->subLinkType == EXISTS_SUBLINK)
|
||||
{
|
||||
if ((j = convert_EXISTS_sublink_to_join(root, sublink, true,
|
||||
available_rels1)) != NULL)
|
||||
available_rels1)) != NULL)
|
||||
{
|
||||
/* Yes; insert the new join node into the join tree */
|
||||
j->larg = *jtlink1;
|
||||
@ -490,7 +490,7 @@ pull_up_sublinks_qual_recurse(PlannerInfo *root, Node *node,
|
||||
}
|
||||
if (available_rels2 != NULL &&
|
||||
(j = convert_EXISTS_sublink_to_join(root, sublink, true,
|
||||
available_rels2)) != NULL)
|
||||
available_rels2)) != NULL)
|
||||
{
|
||||
/* Yes; insert the new join node into the join tree */
|
||||
j->larg = *jtlink2;
|
||||
@ -793,12 +793,12 @@ pull_up_subqueries_recurse(PlannerInfo *root, Node *jtnode,
|
||||
*/
|
||||
j->larg = pull_up_subqueries_recurse(root, j->larg,
|
||||
lowest_outer_join,
|
||||
lowest_nulling_outer_join,
|
||||
lowest_nulling_outer_join,
|
||||
NULL,
|
||||
true);
|
||||
j->rarg = pull_up_subqueries_recurse(root, j->rarg,
|
||||
lowest_outer_join,
|
||||
lowest_nulling_outer_join,
|
||||
lowest_nulling_outer_join,
|
||||
NULL,
|
||||
j->larg != NULL);
|
||||
break;
|
||||
@ -807,7 +807,7 @@ pull_up_subqueries_recurse(PlannerInfo *root, Node *jtnode,
|
||||
case JOIN_ANTI:
|
||||
j->larg = pull_up_subqueries_recurse(root, j->larg,
|
||||
j,
|
||||
lowest_nulling_outer_join,
|
||||
lowest_nulling_outer_join,
|
||||
NULL,
|
||||
false);
|
||||
j->rarg = pull_up_subqueries_recurse(root, j->rarg,
|
||||
@ -836,7 +836,7 @@ pull_up_subqueries_recurse(PlannerInfo *root, Node *jtnode,
|
||||
false);
|
||||
j->rarg = pull_up_subqueries_recurse(root, j->rarg,
|
||||
j,
|
||||
lowest_nulling_outer_join,
|
||||
lowest_nulling_outer_join,
|
||||
NULL,
|
||||
false);
|
||||
break;
|
||||
@ -1523,7 +1523,7 @@ is_simple_subquery(Query *subquery, RangeTblEntry *rte,
|
||||
}
|
||||
|
||||
if (jointree_contains_lateral_outer_refs((Node *) subquery->jointree,
|
||||
restricted, safe_upper_varnos))
|
||||
restricted, safe_upper_varnos))
|
||||
return false;
|
||||
|
||||
/*
|
||||
@ -2185,7 +2185,7 @@ pullup_replace_vars_callback(Var *var,
|
||||
* level-zero var must belong to the subquery.
|
||||
*/
|
||||
if ((rcon->target_rte->lateral ?
|
||||
bms_overlap(pull_varnos((Node *) newnode), rcon->relids) :
|
||||
bms_overlap(pull_varnos((Node *) newnode), rcon->relids) :
|
||||
contain_vars_of_level((Node *) newnode, 0)) &&
|
||||
!contain_nonstrict_functions((Node *) newnode))
|
||||
{
|
||||
@ -2739,7 +2739,7 @@ reduce_outer_joins_pass2(Node *jtnode,
|
||||
{
|
||||
/* OK to merge upper and local constraints */
|
||||
local_nonnullable_rels = bms_add_members(local_nonnullable_rels,
|
||||
nonnullable_rels);
|
||||
nonnullable_rels);
|
||||
local_nonnullable_vars = list_concat(local_nonnullable_vars,
|
||||
nonnullable_vars);
|
||||
local_forced_null_vars = list_concat(local_forced_null_vars,
|
||||
|
@ -356,7 +356,7 @@ recurse_set_operations(Node *setOp, PlannerInfo *root,
|
||||
*pNumGroups = subpath->rows;
|
||||
else
|
||||
*pNumGroups = estimate_num_groups(subroot,
|
||||
get_tlist_exprs(subquery->targetList, false),
|
||||
get_tlist_exprs(subquery->targetList, false),
|
||||
subpath->rows,
|
||||
NULL);
|
||||
}
|
||||
@ -724,14 +724,14 @@ generate_nonunion_path(SetOperationStmt *op, PlannerInfo *root,
|
||||
*/
|
||||
use_hash = choose_hashed_setop(root, groupList, path,
|
||||
dNumGroups, dNumOutputRows,
|
||||
(op->op == SETOP_INTERSECT) ? "INTERSECT" : "EXCEPT");
|
||||
(op->op == SETOP_INTERSECT) ? "INTERSECT" : "EXCEPT");
|
||||
|
||||
if (!use_hash)
|
||||
path = (Path *) create_sort_path(root,
|
||||
result_rel,
|
||||
path,
|
||||
make_pathkeys_for_sortclauses(root,
|
||||
groupList,
|
||||
groupList,
|
||||
tlist),
|
||||
-1.0);
|
||||
|
||||
@ -887,7 +887,7 @@ make_union_unique(SetOperationStmt *op, Path *path, List *tlist,
|
||||
result_rel,
|
||||
path,
|
||||
make_pathkeys_for_sortclauses(root,
|
||||
groupList,
|
||||
groupList,
|
||||
tlist),
|
||||
-1.0);
|
||||
/* We have to manually jam the right tlist into the path; ick */
|
||||
@ -1527,11 +1527,11 @@ expand_inherited_rtentry(PlannerInfo *root, RangeTblEntry *rte, Index rti)
|
||||
if (childOID != parentOID)
|
||||
{
|
||||
childrte->selectedCols = translate_col_privs(rte->selectedCols,
|
||||
appinfo->translated_vars);
|
||||
appinfo->translated_vars);
|
||||
childrte->insertedCols = translate_col_privs(rte->insertedCols,
|
||||
appinfo->translated_vars);
|
||||
appinfo->translated_vars);
|
||||
childrte->updatedCols = translate_col_privs(rte->updatedCols,
|
||||
appinfo->translated_vars);
|
||||
appinfo->translated_vars);
|
||||
}
|
||||
}
|
||||
else
|
||||
@ -1740,7 +1740,7 @@ translate_col_privs(const Bitmapset *parent_privs,
|
||||
if (bms_is_member(attno - FirstLowInvalidHeapAttributeNumber,
|
||||
parent_privs))
|
||||
child_privs = bms_add_member(child_privs,
|
||||
attno - FirstLowInvalidHeapAttributeNumber);
|
||||
attno - FirstLowInvalidHeapAttributeNumber);
|
||||
}
|
||||
|
||||
/* Check if parent has whole-row reference */
|
||||
@ -1760,7 +1760,7 @@ translate_col_privs(const Bitmapset *parent_privs,
|
||||
bms_is_member(attno - FirstLowInvalidHeapAttributeNumber,
|
||||
parent_privs))
|
||||
child_privs = bms_add_member(child_privs,
|
||||
var->varattno - FirstLowInvalidHeapAttributeNumber);
|
||||
var->varattno - FirstLowInvalidHeapAttributeNumber);
|
||||
}
|
||||
|
||||
return child_privs;
|
||||
@ -1927,7 +1927,7 @@ adjust_appendrel_attrs_mutator(Node *node,
|
||||
JoinExpr *j;
|
||||
|
||||
j = (JoinExpr *) expression_tree_mutator(node,
|
||||
adjust_appendrel_attrs_mutator,
|
||||
adjust_appendrel_attrs_mutator,
|
||||
(void *) context);
|
||||
/* now fix JoinExpr's rtindex (probably never happens) */
|
||||
if (j->rtindex == appinfo->parent_relid)
|
||||
@ -1940,7 +1940,7 @@ adjust_appendrel_attrs_mutator(Node *node,
|
||||
PlaceHolderVar *phv;
|
||||
|
||||
phv = (PlaceHolderVar *) expression_tree_mutator(node,
|
||||
adjust_appendrel_attrs_mutator,
|
||||
adjust_appendrel_attrs_mutator,
|
||||
(void *) context);
|
||||
/* now fix PlaceHolderVar's relid sets */
|
||||
if (phv->phlevelsup == 0)
|
||||
|
@ -147,14 +147,14 @@ static Expr *inline_function(Oid funcid, Oid result_type, Oid result_collid,
|
||||
static Node *substitute_actual_parameters(Node *expr, int nargs, List *args,
|
||||
int *usecounts);
|
||||
static Node *substitute_actual_parameters_mutator(Node *node,
|
||||
substitute_actual_parameters_context *context);
|
||||
substitute_actual_parameters_context *context);
|
||||
static void sql_inline_error_callback(void *arg);
|
||||
static Expr *evaluate_expr(Expr *expr, Oid result_type, int32 result_typmod,
|
||||
Oid result_collation);
|
||||
static Query *substitute_actual_srf_parameters(Query *expr,
|
||||
int nargs, List *args);
|
||||
static Node *substitute_actual_srf_parameters_mutator(Node *node,
|
||||
substitute_actual_srf_parameters_context *context);
|
||||
substitute_actual_srf_parameters_context *context);
|
||||
static bool tlist_matches_coltypelist(List *tlist, List *coltypelist);
|
||||
|
||||
|
||||
@ -1011,7 +1011,7 @@ contain_volatile_functions_not_nextval_walker(Node *node, void *context)
|
||||
return false;
|
||||
/* Check for volatile functions in node itself */
|
||||
if (check_functions_in_node(node,
|
||||
contain_volatile_functions_not_nextval_checker,
|
||||
contain_volatile_functions_not_nextval_checker,
|
||||
context))
|
||||
return true;
|
||||
|
||||
@ -1026,11 +1026,11 @@ contain_volatile_functions_not_nextval_walker(Node *node, void *context)
|
||||
{
|
||||
/* Recurse into subselects */
|
||||
return query_tree_walker((Query *) node,
|
||||
contain_volatile_functions_not_nextval_walker,
|
||||
contain_volatile_functions_not_nextval_walker,
|
||||
context, 0);
|
||||
}
|
||||
return expression_tree_walker(node,
|
||||
contain_volatile_functions_not_nextval_walker,
|
||||
contain_volatile_functions_not_nextval_walker,
|
||||
context);
|
||||
}
|
||||
|
||||
@ -1432,7 +1432,7 @@ contain_context_dependent_node_walker(Node *node, int *flags)
|
||||
*/
|
||||
*flags |= CCDN_IN_CASEEXPR;
|
||||
res = expression_tree_walker(node,
|
||||
contain_context_dependent_node_walker,
|
||||
contain_context_dependent_node_walker,
|
||||
(void *) flags);
|
||||
*flags = save_flags;
|
||||
return res;
|
||||
@ -2675,7 +2675,7 @@ eval_const_expressions_mutator(Node *node,
|
||||
* self.
|
||||
*/
|
||||
args = (List *) expression_tree_mutator((Node *) expr->args,
|
||||
eval_const_expressions_mutator,
|
||||
eval_const_expressions_mutator,
|
||||
(void *) context);
|
||||
|
||||
/*
|
||||
@ -2943,7 +2943,7 @@ eval_const_expressions_mutator(Node *node,
|
||||
-1,
|
||||
InvalidOid,
|
||||
sizeof(Oid),
|
||||
ObjectIdGetDatum(intypioparam),
|
||||
ObjectIdGetDatum(intypioparam),
|
||||
false,
|
||||
true),
|
||||
makeConst(INT4OID,
|
||||
@ -3009,7 +3009,7 @@ eval_const_expressions_mutator(Node *node,
|
||||
*/
|
||||
if (arg && IsA(arg, Const) &&
|
||||
(!OidIsValid(newexpr->elemfuncid) ||
|
||||
func_volatile(newexpr->elemfuncid) == PROVOLATILE_IMMUTABLE))
|
||||
func_volatile(newexpr->elemfuncid) == PROVOLATILE_IMMUTABLE))
|
||||
return (Node *) evaluate_expr((Expr *) newexpr,
|
||||
newexpr->resulttype,
|
||||
newexpr->resulttypmod,
|
||||
@ -3286,7 +3286,7 @@ eval_const_expressions_mutator(Node *node,
|
||||
if (newargs == NIL)
|
||||
return (Node *) makeNullConst(coalesceexpr->coalescetype,
|
||||
-1,
|
||||
coalesceexpr->coalescecollid);
|
||||
coalesceexpr->coalescecollid);
|
||||
|
||||
newcoalesce = makeNode(CoalesceExpr);
|
||||
newcoalesce->coalescetype = coalesceexpr->coalescetype;
|
||||
@ -3365,7 +3365,7 @@ eval_const_expressions_mutator(Node *node,
|
||||
fselect->fieldnum <= list_length(rowexpr->args))
|
||||
{
|
||||
Node *fld = (Node *) list_nth(rowexpr->args,
|
||||
fselect->fieldnum - 1);
|
||||
fselect->fieldnum - 1);
|
||||
|
||||
if (rowtype_field_matches(rowexpr->row_typeid,
|
||||
fselect->fieldnum,
|
||||
@ -3900,7 +3900,7 @@ simplify_function(Oid funcid, Oid result_type, int32 result_typmod,
|
||||
{
|
||||
args = expand_function_arguments(args, result_type, func_tuple);
|
||||
args = (List *) expression_tree_mutator((Node *) args,
|
||||
eval_const_expressions_mutator,
|
||||
eval_const_expressions_mutator,
|
||||
(void *) context);
|
||||
/* Argument processing done, give it back to the caller */
|
||||
*args_p = args;
|
||||
@ -4623,7 +4623,7 @@ substitute_actual_parameters(Node *expr, int nargs, List *args,
|
||||
|
||||
static Node *
|
||||
substitute_actual_parameters_mutator(Node *node,
|
||||
substitute_actual_parameters_context *context)
|
||||
substitute_actual_parameters_context *context)
|
||||
{
|
||||
if (node == NULL)
|
||||
return NULL;
|
||||
@ -4943,7 +4943,7 @@ inline_set_returning_function(PlannerInfo *root, RangeTblEntry *rte)
|
||||
|
||||
querytree_list = pg_analyze_and_rewrite_params(linitial(raw_parsetree_list),
|
||||
src,
|
||||
(ParserSetupHook) sql_fn_parser_setup,
|
||||
(ParserSetupHook) sql_fn_parser_setup,
|
||||
pinfo, NULL);
|
||||
if (list_length(querytree_list) != 1)
|
||||
goto fail;
|
||||
@ -5066,7 +5066,7 @@ substitute_actual_srf_parameters(Query *expr, int nargs, List *args)
|
||||
|
||||
static Node *
|
||||
substitute_actual_srf_parameters_mutator(Node *node,
|
||||
substitute_actual_srf_parameters_context *context)
|
||||
substitute_actual_srf_parameters_context *context)
|
||||
{
|
||||
Node *result;
|
||||
|
||||
@ -5076,7 +5076,7 @@ substitute_actual_srf_parameters_mutator(Node *node,
|
||||
{
|
||||
context->sublevels_up++;
|
||||
result = (Node *) query_tree_mutator((Query *) node,
|
||||
substitute_actual_srf_parameters_mutator,
|
||||
substitute_actual_srf_parameters_mutator,
|
||||
(void *) context,
|
||||
0);
|
||||
context->sublevels_up--;
|
||||
|
@ -233,7 +233,7 @@ extract_or_clause(RestrictInfo *or_rinfo, RelOptInfo *rel)
|
||||
subclause = (Node *) make_ands_explicit(subclauses);
|
||||
if (or_clause(subclause))
|
||||
clauselist = list_concat(clauselist,
|
||||
list_copy(((BoolExpr *) subclause)->args));
|
||||
list_copy(((BoolExpr *) subclause)->args));
|
||||
else
|
||||
clauselist = lappend(clauselist, subclause);
|
||||
}
|
||||
|
@ -477,7 +477,7 @@ add_path(RelOptInfo *parent_rel, Path *new_path)
|
||||
{
|
||||
case COSTS_EQUAL:
|
||||
outercmp = bms_subset_compare(PATH_REQ_OUTER(new_path),
|
||||
PATH_REQ_OUTER(old_path));
|
||||
PATH_REQ_OUTER(old_path));
|
||||
if (keyscmp == PATHKEYS_BETTER1)
|
||||
{
|
||||
if ((outercmp == BMS_EQUAL ||
|
||||
@ -525,7 +525,7 @@ add_path(RelOptInfo *parent_rel, Path *new_path)
|
||||
accept_new = false; /* old dominates new */
|
||||
else if (compare_path_costs_fuzzily(new_path,
|
||||
old_path,
|
||||
1.0000000001) == COSTS_BETTER1)
|
||||
1.0000000001) == COSTS_BETTER1)
|
||||
remove_old = true; /* new dominates old */
|
||||
else
|
||||
accept_new = false; /* old equals or
|
||||
@ -546,7 +546,7 @@ add_path(RelOptInfo *parent_rel, Path *new_path)
|
||||
if (keyscmp != PATHKEYS_BETTER2)
|
||||
{
|
||||
outercmp = bms_subset_compare(PATH_REQ_OUTER(new_path),
|
||||
PATH_REQ_OUTER(old_path));
|
||||
PATH_REQ_OUTER(old_path));
|
||||
if ((outercmp == BMS_EQUAL ||
|
||||
outercmp == BMS_SUBSET1) &&
|
||||
new_path->rows <= old_path->rows &&
|
||||
@ -558,7 +558,7 @@ add_path(RelOptInfo *parent_rel, Path *new_path)
|
||||
if (keyscmp != PATHKEYS_BETTER1)
|
||||
{
|
||||
outercmp = bms_subset_compare(PATH_REQ_OUTER(new_path),
|
||||
PATH_REQ_OUTER(old_path));
|
||||
PATH_REQ_OUTER(old_path));
|
||||
if ((outercmp == BMS_EQUAL ||
|
||||
outercmp == BMS_SUBSET2) &&
|
||||
new_path->rows >= old_path->rows &&
|
||||
|
@ -620,7 +620,7 @@ infer_arbiter_indexes(PlannerInfo *root)
|
||||
errmsg("whole row unique index inference specifications are not supported")));
|
||||
|
||||
inferAttrs = bms_add_member(inferAttrs,
|
||||
attno - FirstLowInvalidHeapAttributeNumber);
|
||||
attno - FirstLowInvalidHeapAttributeNumber);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -715,7 +715,7 @@ infer_arbiter_indexes(PlannerInfo *root)
|
||||
|
||||
if (attno != 0)
|
||||
indexedAttrs = bms_add_member(indexedAttrs,
|
||||
attno - FirstLowInvalidHeapAttributeNumber);
|
||||
attno - FirstLowInvalidHeapAttributeNumber);
|
||||
}
|
||||
|
||||
/* Non-expression attributes (if any) must match */
|
||||
@ -1607,7 +1607,7 @@ build_index_tlist(PlannerInfo *root, IndexOptInfo *index,
|
||||
|
||||
if (indexkey < 0)
|
||||
att_tup = SystemAttributeDefinition(indexkey,
|
||||
heapRelation->rd_rel->relhasoids);
|
||||
heapRelation->rd_rel->relhasoids);
|
||||
else
|
||||
att_tup = heapRelation->rd_att->attrs[indexkey - 1];
|
||||
|
||||
|
@ -279,7 +279,7 @@ build_join_rel_hash(PlannerInfo *root)
|
||||
hashtab = hash_create("JoinRelHashTable",
|
||||
256L,
|
||||
&hash_ctl,
|
||||
HASH_ELEM | HASH_FUNCTION | HASH_COMPARE | HASH_CONTEXT);
|
||||
HASH_ELEM | HASH_FUNCTION | HASH_COMPARE | HASH_CONTEXT);
|
||||
|
||||
/* Insert all the already-existing joinrels */
|
||||
foreach(l, root->join_rel_list)
|
||||
|
@ -240,7 +240,7 @@ pull_varattnos_walker(Node *node, pull_varattnos_context *context)
|
||||
if (var->varno == context->varno && var->varlevelsup == 0)
|
||||
context->varattnos =
|
||||
bms_add_member(context->varattnos,
|
||||
var->varattno - FirstLowInvalidHeapAttributeNumber);
|
||||
var->varattno - FirstLowInvalidHeapAttributeNumber);
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -778,7 +778,7 @@ flatten_join_alias_vars_mutator(Node *node,
|
||||
PlaceHolderVar *phv;
|
||||
|
||||
phv = (PlaceHolderVar *) expression_tree_mutator(node,
|
||||
flatten_join_alias_vars_mutator,
|
||||
flatten_join_alias_vars_mutator,
|
||||
(void *) context);
|
||||
/* now fix PlaceHolderVar's relid sets */
|
||||
if (phv->phlevelsup == context->sublevels_up)
|
||||
|
Reference in New Issue
Block a user