From 382ceffdf7f620d8f2d50e451b4167d291ae2348 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Wed, 21 Jun 2017 15:35:54 -0400 Subject: 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 --- src/backend/optimizer/plan/createplan.c | 50 ++++++++++++++++----------------- 1 file changed, 25 insertions(+), 25 deletions(-) (limited to 'src/backend/optimizer/plan/createplan.c') diff --git a/src/backend/optimizer/plan/createplan.c b/src/backend/optimizer/plan/createplan.c index b510faa3e11..e589d92c805 100644 --- a/src/backend/optimizer/plan/createplan.c +++ b/src/backend/optimizer/plan/createplan.c @@ -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)) -- cgit v1.2.3