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

@ -443,8 +443,8 @@ check_lateral_ref_ok(ParseState *pstate, ParseNamespaceItem *nsitem,
ereport(ERROR,
(errcode(ERRCODE_INVALID_COLUMN_REFERENCE),
errmsg("invalid reference to FROM-clause entry for table \"%s\"",
refname),
errmsg("invalid reference to FROM-clause entry for table \"%s\"",
refname),
(rte == pstate->p_target_rangetblentry) ?
errhint("There is an entry for table \"%s\", but it cannot be referenced from this part of the query.",
refname) :
@ -868,7 +868,7 @@ searchRangeTableForCol(ParseState *pstate, const char *alias, char *colname,
fuzzy_rte_penalty =
varstr_levenshtein_less_equal(alias, strlen(alias),
rte->eref->aliasname,
strlen(rte->eref->aliasname),
strlen(rte->eref->aliasname),
1, 1, 1,
MAX_FUZZY_DISTANCE + 1,
true);
@ -918,7 +918,7 @@ markRTEForSelectPriv(ParseState *pstate, RangeTblEntry *rte,
rte->requiredPerms |= ACL_SELECT;
/* Must offset the attnum to fit in a bitmapset */
rte->selectedCols = bms_add_member(rte->selectedCols,
col - FirstLowInvalidHeapAttributeNumber);
col - FirstLowInvalidHeapAttributeNumber);
}
else if (rte->rtekind == RTE_JOIN)
{
@ -1491,7 +1491,7 @@ addRangeTableEntryForFunction(ParseState *pstate,
(errcode(ERRCODE_SYNTAX_ERROR),
errmsg("a column definition list is only allowed for functions returning \"record\""),
parser_errposition(pstate,
exprLocation((Node *) coldeflist))));
exprLocation((Node *) coldeflist))));
}
else
{
@ -1577,8 +1577,8 @@ addRangeTableEntryForFunction(ParseState *pstate,
else
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("function \"%s\" in FROM has unsupported return type %s",
funcname, format_type_be(funcrettype)),
errmsg("function \"%s\" in FROM has unsupported return type %s",
funcname, format_type_be(funcrettype)),
parser_errposition(pstate, exprLocation(funcexpr))));
/* Finish off the RangeTblFunction and add it to the RTE's list */
@ -1688,7 +1688,7 @@ addRangeTableEntryForTableFunc(ParseState *pstate,
/* fill in any unspecified alias columns */
if (numaliases < list_length(tf->colnames))
eref->colnames = list_concat(eref->colnames,
list_copy_tail(tf->colnames, numaliases));
list_copy_tail(tf->colnames, numaliases));
rte->eref = eref;
@ -1911,8 +1911,8 @@ addRangeTableEntryForCTE(ParseState *pstate,
ctequery->returningList == NIL)
ereport(ERROR,
(errcode(ERRCODE_FEATURE_NOT_SUPPORTED),
errmsg("WITH query \"%s\" does not have a RETURNING clause",
cte->ctename),
errmsg("WITH query \"%s\" does not have a RETURNING clause",
cte->ctename),
parser_errposition(pstate, rv->location)));
}
@ -2529,7 +2529,7 @@ expandTupleDesc(TupleDesc tupdesc, Alias *eref, int count, int offset,
* what type the Const claims to be.
*/
*colvars = lappend(*colvars,
makeNullConst(INT4OID, -1, InvalidOid));
makeNullConst(INT4OID, -1, InvalidOid));
}
}
if (aliascell)
@ -2696,9 +2696,9 @@ get_rte_attribute_type(RangeTblEntry *rte, AttrNumber attnum,
if (att_tup->attisdropped)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_COLUMN),
errmsg("column \"%s\" of relation \"%s\" does not exist",
NameStr(att_tup->attname),
get_rel_name(rte->relid))));
errmsg("column \"%s\" of relation \"%s\" does not exist",
NameStr(att_tup->attname),
get_rel_name(rte->relid))));
*vartype = att_tup->atttypid;
*vartypmod = att_tup->atttypmod;
*varcollid = att_tup->attcollation;
@ -3185,11 +3185,11 @@ errorMissingRTE(ParseState *pstate, RangeVar *relation)
if (rte)
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_TABLE),
errmsg("invalid reference to FROM-clause entry for table \"%s\"",
relation->relname),
errmsg("invalid reference to FROM-clause entry for table \"%s\"",
relation->relname),
(badAlias ?
errhint("Perhaps you meant to reference the table alias \"%s\".",
badAlias) :
errhint("Perhaps you meant to reference the table alias \"%s\".",
badAlias) :
errhint("There is an entry for table \"%s\", but it cannot be referenced from this part of the query.",
rte->eref->aliasname)),
parser_errposition(pstate, relation->location)));
@ -3248,8 +3248,8 @@ errorMissingColumn(ParseState *pstate,
errmsg("column %s.%s does not exist", relname, colname) :
errmsg("column \"%s\" does not exist", colname),
state->rfirst ? closestfirst ?
errhint("Perhaps you meant to reference the column \"%s.%s\".",
state->rfirst->eref->aliasname, closestfirst) :
errhint("Perhaps you meant to reference the column \"%s.%s\".",
state->rfirst->eref->aliasname, closestfirst) :
errhint("There is a column named \"%s\" in table \"%s\", but it cannot be referenced from this part of the query.",
colname, state->rfirst->eref->aliasname) : 0,
parser_errposition(pstate, location)));