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

@ -302,7 +302,7 @@ coerce_type(ParseState *pstate, Node *node,
*/
if (!con->constisnull)
newcon->constvalue = stringTypeDatum(baseType,
DatumGetCString(con->constvalue),
DatumGetCString(con->constvalue),
inputTypeMod);
else
newcon->constvalue = stringTypeDatum(baseType,
@ -342,7 +342,7 @@ coerce_type(ParseState *pstate, Node *node,
val2 = PointerGetDatum(PG_DETOAST_DATUM(val2));
if (!datumIsEqual(newcon->constvalue, val2, false, newcon->constlen))
elog(WARNING, "type %s has unstable input conversion for \"%s\"",
typeTypeName(baseType), DatumGetCString(con->constvalue));
typeTypeName(baseType), DatumGetCString(con->constvalue));
}
#endif
@ -418,7 +418,7 @@ coerce_type(ParseState *pstate, Node *node,
result = build_coercion_expression(node, pathtype, funcId,
baseTypeId, baseTypeMod,
cformat, location,
(cformat != COERCE_IMPLICIT_CAST));
(cformat != COERCE_IMPLICIT_CAST));
/*
* If domain, coerce to the domain type and relabel with domain
@ -1646,7 +1646,7 @@ enforce_generic_type_consistency(Oid *actual_arg_types,
if (OidIsValid(elem_typeid) && actual_type != elem_typeid)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("arguments declared \"anyelement\" are not all alike"),
errmsg("arguments declared \"anyelement\" are not all alike"),
errdetail("%s versus %s",
format_type_be(elem_typeid),
format_type_be(actual_type))));
@ -1666,7 +1666,7 @@ enforce_generic_type_consistency(Oid *actual_arg_types,
if (OidIsValid(array_typeid) && actual_type != array_typeid)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("arguments declared \"anyarray\" are not all alike"),
errmsg("arguments declared \"anyarray\" are not all alike"),
errdetail("%s versus %s",
format_type_be(array_typeid),
format_type_be(actual_type))));
@ -1686,7 +1686,7 @@ enforce_generic_type_consistency(Oid *actual_arg_types,
if (OidIsValid(range_typeid) && actual_type != range_typeid)
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("arguments declared \"anyrange\" are not all alike"),
errmsg("arguments declared \"anyrange\" are not all alike"),
errdetail("%s versus %s",
format_type_be(range_typeid),
format_type_be(actual_type))));
@ -1715,8 +1715,8 @@ enforce_generic_type_consistency(Oid *actual_arg_types,
if (!OidIsValid(array_typelem))
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("argument declared %s is not an array but type %s",
"anyarray", format_type_be(array_typeid))));
errmsg("argument declared %s is not an array but type %s",
"anyarray", format_type_be(array_typeid))));
}
if (!OidIsValid(elem_typeid))
@ -1753,9 +1753,9 @@ enforce_generic_type_consistency(Oid *actual_arg_types,
if (!OidIsValid(range_typelem))
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("argument declared %s is not a range type but type %s",
"anyrange",
format_type_be(range_typeid))));
errmsg("argument declared %s is not a range type but type %s",
"anyrange",
format_type_be(range_typeid))));
}
if (!OidIsValid(elem_typeid))
@ -1802,8 +1802,8 @@ enforce_generic_type_consistency(Oid *actual_arg_types,
if (type_is_array_domain(elem_typeid))
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("type matched to anynonarray is an array type: %s",
format_type_be(elem_typeid))));
errmsg("type matched to anynonarray is an array type: %s",
format_type_be(elem_typeid))));
}
if (have_anyenum && elem_typeid != ANYELEMENTOID)
@ -1841,8 +1841,8 @@ enforce_generic_type_consistency(Oid *actual_arg_types,
if (!OidIsValid(array_typeid))
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("could not find array type for data type %s",
format_type_be(elem_typeid))));
errmsg("could not find array type for data type %s",
format_type_be(elem_typeid))));
}
declared_arg_types[j] = array_typeid;
}
@ -1852,8 +1852,8 @@ enforce_generic_type_consistency(Oid *actual_arg_types,
{
ereport(ERROR,
(errcode(ERRCODE_UNDEFINED_OBJECT),
errmsg("could not find range type for data type %s",
format_type_be(elem_typeid))));
errmsg("could not find range type for data type %s",
format_type_be(elem_typeid))));
}
declared_arg_types[j] = range_typeid;
}
@ -1930,8 +1930,8 @@ resolve_generic_type(Oid declared_type,
if (!OidIsValid(array_typelem))
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("argument declared %s is not an array but type %s",
"anyarray", format_type_be(context_base_type))));
errmsg("argument declared %s is not an array but type %s",
"anyarray", format_type_be(context_base_type))));
return context_base_type;
}
else if (context_declared_type == ANYELEMENTOID ||
@ -1964,8 +1964,8 @@ resolve_generic_type(Oid declared_type,
if (!OidIsValid(array_typelem))
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("argument declared %s is not an array but type %s",
"anyarray", format_type_be(context_base_type))));
errmsg("argument declared %s is not an array but type %s",
"anyarray", format_type_be(context_base_type))));
return array_typelem;
}
else if (context_declared_type == ANYRANGEOID)
@ -1977,8 +1977,8 @@ resolve_generic_type(Oid declared_type,
if (!OidIsValid(range_typelem))
ereport(ERROR,
(errcode(ERRCODE_DATATYPE_MISMATCH),
errmsg("argument declared %s is not a range type but type %s",
"anyrange", format_type_be(context_base_type))));
errmsg("argument declared %s is not a range type but type %s",
"anyrange", format_type_be(context_base_type))));
return range_typelem;
}
else if (context_declared_type == ANYELEMENTOID ||
@ -2253,7 +2253,7 @@ find_coercion_pathway(Oid targetTypeId, Oid sourceTypeId,
Oid sourceElem;
if ((targetElem = get_element_type(targetTypeId)) != InvalidOid &&
(sourceElem = get_base_element_type(sourceTypeId)) != InvalidOid)
(sourceElem = get_base_element_type(sourceTypeId)) != InvalidOid)
{
CoercionPathType elempathtype;
Oid elemfuncid;