1
0
mirror of https://github.com/postgres/postgres.git synced 2025-11-21 00:42:43 +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:
Tom Lane
2017-06-21 15:35:54 -04:00
parent c7b8998ebb
commit 382ceffdf7
568 changed files with 4747 additions and 4745 deletions

View File

@@ -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,

View File

@@ -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)