diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2017-06-21 15:35:54 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2017-06-21 15:35:54 -0400 |
commit | 382ceffdf7f620d8f2d50e451b4167d291ae2348 (patch) | |
tree | f558251492f2c6f86e3566f7a82f9d00509122c2 /src/backend/parser/parse_expr.c | |
parent | c7b8998ebbf310a156aa38022555a24d98fdbfb4 (diff) | |
download | postgresql-382ceffdf7f620d8f2d50e451b4167d291ae2348.tar.gz postgresql-382ceffdf7f620d8f2d50e451b4167d291ae2348.zip |
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
Diffstat (limited to 'src/backend/parser/parse_expr.c')
-rw-r--r-- | src/backend/parser/parse_expr.c | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/src/backend/parser/parse_expr.c b/src/backend/parser/parse_expr.c index 3a9cdb42089..6d8cb07766b 100644 --- a/src/backend/parser/parse_expr.c +++ b/src/backend/parser/parse_expr.c @@ -418,8 +418,8 @@ unknown_attribute(ParseState *pstate, Node *relref, char *attname, else if (relTypeId == RECORDOID) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_COLUMN), - errmsg("could not identify column \"%s\" in record data type", - attname), + errmsg("could not identify column \"%s\" in record data type", + attname), parser_errposition(pstate, location))); else ereport(ERROR, @@ -786,15 +786,15 @@ transformColumnRef(ParseState *pstate, ColumnRef *cref) case CRERR_WRONG_DB: ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("cross-database references are not implemented: %s", - NameListToString(cref->fields)), + errmsg("cross-database references are not implemented: %s", + NameListToString(cref->fields)), parser_errposition(pstate, cref->location))); break; case CRERR_TOO_MANY: ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("improper qualified name (too many dotted names): %s", - NameListToString(cref->fields)), + errmsg("improper qualified name (too many dotted names): %s", + NameListToString(cref->fields)), parser_errposition(pstate, cref->location))); break; } @@ -1263,7 +1263,7 @@ transformAExprIn(ParseState *pstate, A_Expr *a) /* ROW() op ROW() is handled specially */ cmp = make_row_comparison_op(pstate, a->name, - copyObject(((RowExpr *) lexpr)->args), + copyObject(((RowExpr *) lexpr)->args), ((RowExpr *) rexpr)->args, a->location); } @@ -1364,10 +1364,10 @@ transformAExprBetween(ParseState *pstate, A_Expr *a) a->location)); sub1 = (Node *) makeBoolExpr(AND_EXPR, args, a->location); args = list_make2(makeSimpleA_Expr(AEXPR_OP, ">=", - copyObject(aexpr), copyObject(cexpr), + copyObject(aexpr), copyObject(cexpr), a->location), makeSimpleA_Expr(AEXPR_OP, "<=", - copyObject(aexpr), copyObject(bexpr), + copyObject(aexpr), copyObject(bexpr), a->location)); sub2 = (Node *) makeBoolExpr(AND_EXPR, args, a->location); args = list_make2(sub1, sub2); @@ -1382,10 +1382,10 @@ transformAExprBetween(ParseState *pstate, A_Expr *a) a->location)); sub1 = (Node *) makeBoolExpr(OR_EXPR, args, a->location); args = list_make2(makeSimpleA_Expr(AEXPR_OP, "<", - copyObject(aexpr), copyObject(cexpr), + copyObject(aexpr), copyObject(cexpr), a->location), makeSimpleA_Expr(AEXPR_OP, ">", - copyObject(aexpr), copyObject(bexpr), + copyObject(aexpr), copyObject(bexpr), a->location)); sub2 = (Node *) makeBoolExpr(OR_EXPR, args, a->location); args = list_make2(sub1, sub2); @@ -1516,7 +1516,7 @@ transformMultiAssignRef(ParseState *pstate, MultiAssignRef *maref) if (count_nonjunk_tlist_entries(qtree->targetList) != maref->ncolumns) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("number of columns does not match number of values"), + errmsg("number of columns does not match number of values"), parser_errposition(pstate, sublink->location))); /* @@ -1548,7 +1548,7 @@ transformMultiAssignRef(ParseState *pstate, MultiAssignRef *maref) if (list_length(rexpr->args) != maref->ncolumns) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("number of columns does not match number of values"), + errmsg("number of columns does not match number of values"), parser_errposition(pstate, rexpr->location))); /* @@ -1563,7 +1563,7 @@ transformMultiAssignRef(ParseState *pstate, MultiAssignRef *maref) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("source for a multiple-column UPDATE item must be a sub-SELECT or ROW() expression"), - parser_errposition(pstate, exprLocation(maref->source)))); + parser_errposition(pstate, exprLocation(maref->source)))); } else { @@ -2096,8 +2096,8 @@ transformArrayExpr(ParseState *pstate, A_ArrayExpr *a, if (!OidIsValid(element_type)) ereport(ERROR, (errcode(ERRCODE_UNDEFINED_OBJECT), - errmsg("could not find element type for data type %s", - format_type_be(array_type)), + errmsg("could not find element type for data type %s", + format_type_be(array_type)), parser_errposition(pstate, a->location))); } else @@ -2383,8 +2383,8 @@ transformXmlExpr(ParseState *pstate, XmlExpr *x) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), x->op == IS_XMLELEMENT - ? errmsg("unnamed XML attribute value must be a column reference") - : errmsg("unnamed XML element value must be a column reference"), + ? errmsg("unnamed XML attribute value must be a column reference") + : errmsg("unnamed XML element value must be a column reference"), parser_errposition(pstate, r->location))); argname = NULL; /* keep compiler quiet */ } @@ -2399,8 +2399,8 @@ transformXmlExpr(ParseState *pstate, XmlExpr *x) if (strcmp(argname, strVal(lfirst(lc2))) == 0) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), - errmsg("XML attribute name \"%s\" appears more than once", - argname), + errmsg("XML attribute name \"%s\" appears more than once", + argname), parser_errposition(pstate, r->location))); } } @@ -2480,7 +2480,7 @@ transformXmlSerialize(ParseState *pstate, XmlSerialize *xs) xexpr = makeNode(XmlExpr); xexpr->op = IS_XMLSERIALIZE; xexpr->args = list_make1(coerce_to_specific_type(pstate, - transformExprRecurse(pstate, xs->expr), + transformExprRecurse(pstate, xs->expr), XMLOID, "XMLSERIALIZE")); @@ -2837,9 +2837,9 @@ make_row_comparison_op(ParseState *pstate, List *opname, if (cmp->opresulttype != BOOLOID) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("row comparison operator must yield type boolean, " - "not type %s", - format_type_be(cmp->opresulttype)), + errmsg("row comparison operator must yield type boolean, " + "not type %s", + format_type_be(cmp->opresulttype)), parser_errposition(pstate, location))); if (expression_returns_set((Node *) cmp)) ereport(ERROR, @@ -2946,7 +2946,7 @@ make_row_comparison_op(ParseState *pstate, List *opname, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("could not determine interpretation of row comparison operator %s", strVal(llast(opname))), - errdetail("There are multiple equally-plausible candidates."), + errdetail("There are multiple equally-plausible candidates."), parser_errposition(pstate, location))); } @@ -3039,7 +3039,7 @@ make_distinct_op(ParseState *pstate, List *opname, Node *ltree, Node *rtree, if (((OpExpr *) result)->opresulttype != BOOLOID) ereport(ERROR, (errcode(ERRCODE_DATATYPE_MISMATCH), - errmsg("IS DISTINCT FROM requires = operator to yield boolean"), + errmsg("IS DISTINCT FROM requires = operator to yield boolean"), parser_errposition(pstate, location))); if (((OpExpr *) result)->opretset) ereport(ERROR, |