mirror of
https://github.com/postgres/postgres.git
synced 2025-07-15 19:21:59 +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 */
|
||||
|
Reference in New Issue
Block a user