1
0
mirror of https://github.com/postgres/postgres.git synced 2025-07-14 08:21:07 +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

@ -260,7 +260,7 @@ AcquireRewriteLocks(Query *parsetree,
AcquireRewriteLocks(rte->subquery,
forExecute,
(forUpdatePushedDown ||
get_parse_rowmark(parsetree, rt_index) != NULL));
get_parse_rowmark(parsetree, rt_index) != NULL));
break;
default:
@ -600,7 +600,7 @@ rewriteRuleAction(Query *parsetree,
if (*returning_flag)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot have RETURNING lists in multiple rules")));
errmsg("cannot have RETURNING lists in multiple rules")));
*returning_flag = true;
rule_action->returningList = (List *)
ReplaceVarsFromTargetList((Node *) parsetree->returningList,
@ -806,7 +806,7 @@ rewriteTargetListIU(List *targetList,
* tlist entry is a DEFAULT placeholder node.
*/
apply_default = ((new_tle == NULL && commandType == CMD_INSERT) ||
(new_tle && new_tle->expr && IsA(new_tle->expr, SetToDefault)));
(new_tle && new_tle->expr && IsA(new_tle->expr, SetToDefault)));
if (commandType == CMD_INSERT)
{
@ -818,7 +818,7 @@ rewriteTargetListIU(List *targetList,
errmsg("cannot insert into column \"%s\"", NameStr(att_tup->attname)),
errdetail("Column \"%s\" is an identity column defined as GENERATED ALWAYS.",
NameStr(att_tup->attname)),
errhint("Use OVERRIDING SYSTEM VALUE to override.")));
errhint("Use OVERRIDING SYSTEM VALUE to override.")));
}
if (att_tup->attidentity == ATTRIBUTE_IDENTITY_BY_DEFAULT && override == OVERRIDING_USER_VALUE)
@ -1142,7 +1142,7 @@ build_column_default(Relation rel, int attrno)
NameStr(att_tup->attname),
format_type_be(atttype),
format_type_be(exprtype)),
errhint("You will need to rewrite or cast the expression.")));
errhint("You will need to rewrite or cast the expression.")));
return expr;
}
@ -1701,7 +1701,7 @@ fireRIRrules(Query *parsetree, List *activeRIRs, bool forUpdatePushedDown)
{
rte->subquery = fireRIRrules(rte->subquery, activeRIRs,
(forUpdatePushedDown ||
get_parse_rowmark(parsetree, rt_index) != NULL));
get_parse_rowmark(parsetree, rt_index) != NULL));
continue;
}
@ -1902,7 +1902,7 @@ fireRIRrules(Query *parsetree, List *activeRIRs, bool forUpdatePushedDown)
rte->securityQuals);
parsetree->withCheckOptions = list_concat(withCheckOptions,
parsetree->withCheckOptions);
parsetree->withCheckOptions);
}
/*
@ -2629,7 +2629,7 @@ adjust_view_column_set(Bitmapset *cols, List *targetlist)
continue;
var = castNode(Var, tle->expr);
result = bms_add_member(result,
var->varattno - FirstLowInvalidHeapAttributeNumber);
var->varattno - FirstLowInvalidHeapAttributeNumber);
}
}
else
@ -2646,7 +2646,7 @@ adjust_view_column_set(Bitmapset *cols, List *targetlist)
Var *var = (Var *) tle->expr;
result = bms_add_member(result,
var->varattno - FirstLowInvalidHeapAttributeNumber);
var->varattno - FirstLowInvalidHeapAttributeNumber);
}
else
elog(ERROR, "attribute number %d not found in view targetlist",
@ -2750,7 +2750,7 @@ rewriteTargetView(Query *parsetree, Relation view)
if (!tle->resjunk)
modified_cols = bms_add_member(modified_cols,
tle->resno - FirstLowInvalidHeapAttributeNumber);
tle->resno - FirstLowInvalidHeapAttributeNumber);
}
if (parsetree->onConflict)
@ -2761,7 +2761,7 @@ rewriteTargetView(Query *parsetree, Relation view)
if (!tle->resjunk)
modified_cols = bms_add_member(modified_cols,
tle->resno - FirstLowInvalidHeapAttributeNumber);
tle->resno - FirstLowInvalidHeapAttributeNumber);
}
}
@ -2780,18 +2780,18 @@ rewriteTargetView(Query *parsetree, Relation view)
case CMD_INSERT:
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot insert into column \"%s\" of view \"%s\"",
non_updatable_col,
RelationGetRelationName(view)),
errdetail_internal("%s", _(auto_update_detail))));
errmsg("cannot insert into column \"%s\" of view \"%s\"",
non_updatable_col,
RelationGetRelationName(view)),
errdetail_internal("%s", _(auto_update_detail))));
break;
case CMD_UPDATE:
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot update column \"%s\" of view \"%s\"",
non_updatable_col,
RelationGetRelationName(view)),
errdetail_internal("%s", _(auto_update_detail))));
errmsg("cannot update column \"%s\" of view \"%s\"",
non_updatable_col,
RelationGetRelationName(view)),
errdetail_internal("%s", _(auto_update_detail))));
break;
default:
elog(ERROR, "unrecognized CmdType: %d",
@ -3277,10 +3277,10 @@ RewriteQuery(Query *parsetree, List *rewrite_events)
/* Process the main targetlist ... */
parsetree->targetList = rewriteTargetListIU(parsetree->targetList,
parsetree->commandType,
parsetree->override,
parsetree->commandType,
parsetree->override,
rt_entry_relation,
parsetree->resultRelation,
parsetree->resultRelation,
&attrnos);
/* ... and the VALUES expression lists */
rewriteValuesRTE(values_rte, rt_entry_relation, attrnos);
@ -3398,7 +3398,7 @@ RewriteQuery(Query *parsetree, List *rewrite_events)
ereport(ERROR,
(errcode(ERRCODE_INVALID_OBJECT_DEFINITION),
errmsg("infinite recursion detected in rules for relation \"%s\"",
RelationGetRelationName(rt_entry_relation))));
RelationGetRelationName(rt_entry_relation))));
}
rev = (rewrite_event *) palloc(sizeof(rewrite_event));
@ -3435,21 +3435,21 @@ RewriteQuery(Query *parsetree, List *rewrite_events)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot perform INSERT RETURNING on relation \"%s\"",
RelationGetRelationName(rt_entry_relation)),
RelationGetRelationName(rt_entry_relation)),
errhint("You need an unconditional ON INSERT DO INSTEAD rule with a RETURNING clause.")));
break;
case CMD_UPDATE:
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot perform UPDATE RETURNING on relation \"%s\"",
RelationGetRelationName(rt_entry_relation)),
RelationGetRelationName(rt_entry_relation)),
errhint("You need an unconditional ON UPDATE DO INSTEAD rule with a RETURNING clause.")));
break;
case CMD_DELETE:
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("cannot perform DELETE RETURNING on relation \"%s\"",
RelationGetRelationName(rt_entry_relation)),
RelationGetRelationName(rt_entry_relation)),
errhint("You need an unconditional ON DELETE DO INSTEAD rule with a RETURNING clause.")));
break;
default: