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_clause.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_clause.c')
-rw-r--r-- | src/backend/parser/parse_clause.c | 100 |
1 files changed, 50 insertions, 50 deletions
diff --git a/src/backend/parser/parse_clause.c b/src/backend/parser/parse_clause.c index ad76108ba6d..9ff80b8b403 100644 --- a/src/backend/parser/parse_clause.c +++ b/src/backend/parser/parse_clause.c @@ -359,7 +359,7 @@ transformJoinUsingClause(ParseState *pstate, /* Now create the lvar = rvar join condition */ e = makeSimpleA_Expr(AEXPR_OP, "=", - (Node *) copyObject(lvar), (Node *) copyObject(rvar), + (Node *) copyObject(lvar), (Node *) copyObject(rvar), -1); /* Prepare to combine into an AND clause, if multiple join columns */ @@ -636,7 +636,7 @@ transformRangeFunction(ParseState *pstate, RangeFunction *r) (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("set-returning functions must appear at top level of FROM"), parser_errposition(pstate, - exprLocation(pstate->p_last_srf)))); + exprLocation(pstate->p_last_srf)))); funcexprs = lappend(funcexprs, newfexpr); @@ -676,7 +676,7 @@ transformRangeFunction(ParseState *pstate, RangeFunction *r) (errcode(ERRCODE_SYNTAX_ERROR), errmsg("multiple column definition lists are not allowed for the same function"), parser_errposition(pstate, - exprLocation((Node *) r->coldeflist)))); + exprLocation((Node *) r->coldeflist)))); coldeflists = lappend(coldeflists, coldeflist); } @@ -710,22 +710,22 @@ transformRangeFunction(ParseState *pstate, RangeFunction *r) errmsg("ROWS FROM() with multiple functions cannot have a column definition list"), errhint("Put a separate column definition list for each function inside ROWS FROM()."), parser_errposition(pstate, - exprLocation((Node *) r->coldeflist)))); + exprLocation((Node *) r->coldeflist)))); else ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("UNNEST() with multiple arguments cannot have a column definition list"), errhint("Use separate UNNEST() calls inside ROWS FROM(), and attach a column definition list to each one."), parser_errposition(pstate, - exprLocation((Node *) r->coldeflist)))); + exprLocation((Node *) r->coldeflist)))); } if (r->ordinality) ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), errmsg("WITH ORDINALITY cannot be used with a column definition list"), - errhint("Put the column definition list inside ROWS FROM()."), + errhint("Put the column definition list inside ROWS FROM()."), parser_errposition(pstate, - exprLocation((Node *) r->coldeflist)))); + exprLocation((Node *) r->coldeflist)))); coldeflists = list_make1(r->coldeflist); } @@ -785,7 +785,7 @@ transformRangeTableFunc(ParseState *pstate, RangeTableFunc *rtf) /* Transform and apply typecast to the row-generating expression ... */ Assert(rtf->rowexpr != NULL); tf->rowexpr = coerce_to_specific_type(pstate, - transformExpr(pstate, rtf->rowexpr, EXPR_KIND_FROM_FUNCTION), + transformExpr(pstate, rtf->rowexpr, EXPR_KIND_FROM_FUNCTION), TEXTOID, constructName); assign_expr_collations(pstate, tf->rowexpr); @@ -793,7 +793,7 @@ transformRangeTableFunc(ParseState *pstate, RangeTableFunc *rtf) /* ... and to the document itself */ Assert(rtf->docexpr != NULL); tf->docexpr = coerce_to_specific_type(pstate, - transformExpr(pstate, rtf->docexpr, EXPR_KIND_FROM_FUNCTION), + transformExpr(pstate, rtf->docexpr, EXPR_KIND_FROM_FUNCTION), docType, constructName); assign_expr_collations(pstate, tf->docexpr); @@ -849,14 +849,14 @@ transformRangeTableFunc(ParseState *pstate, RangeTableFunc *rtf) tf->coltypes = lappend_oid(tf->coltypes, typid); tf->coltypmods = lappend_int(tf->coltypmods, typmod); tf->colcollations = lappend_oid(tf->colcollations, - type_is_collatable(typid) ? DEFAULT_COLLATION_OID : InvalidOid); + type_is_collatable(typid) ? DEFAULT_COLLATION_OID : InvalidOid); /* Transform the PATH and DEFAULT expressions */ if (rawc->colexpr) { colexpr = coerce_to_specific_type(pstate, - transformExpr(pstate, rawc->colexpr, - EXPR_KIND_FROM_FUNCTION), + transformExpr(pstate, rawc->colexpr, + EXPR_KIND_FROM_FUNCTION), TEXTOID, constructName); assign_expr_collations(pstate, colexpr); @@ -867,8 +867,8 @@ transformRangeTableFunc(ParseState *pstate, RangeTableFunc *rtf) if (rawc->coldefexpr) { coldefexpr = coerce_to_specific_type_typmod(pstate, - transformExpr(pstate, rawc->coldefexpr, - EXPR_KIND_FROM_FUNCTION), + transformExpr(pstate, rawc->coldefexpr, + EXPR_KIND_FROM_FUNCTION), typid, typmod, constructName); assign_expr_collations(pstate, coldefexpr); @@ -1022,12 +1022,12 @@ transformRangeTableSample(ParseState *pstate, RangeTableSample *rts) if (list_length(rts->args) != list_length(tsm->parameterTypes)) ereport(ERROR, (errcode(ERRCODE_INVALID_TABLESAMPLE_ARGUMENT), - errmsg_plural("tablesample method %s requires %d argument, not %d", - "tablesample method %s requires %d arguments, not %d", - list_length(tsm->parameterTypes), - NameListToString(rts->method), - list_length(tsm->parameterTypes), - list_length(rts->args)), + errmsg_plural("tablesample method %s requires %d argument, not %d", + "tablesample method %s requires %d arguments, not %d", + list_length(tsm->parameterTypes), + NameListToString(rts->method), + list_length(tsm->parameterTypes), + list_length(rts->args)), parser_errposition(pstate, rts->location))); /* @@ -1056,8 +1056,8 @@ transformRangeTableSample(ParseState *pstate, RangeTableSample *rts) if (!tsm->repeatable_across_queries) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("tablesample method %s does not support REPEATABLE", - NameListToString(rts->method)), + errmsg("tablesample method %s does not support REPEATABLE", + NameListToString(rts->method)), parser_errposition(pstate, rts->location))); arg = transformExpr(pstate, rts->repeatable, EXPR_KIND_FROM_FUNCTION); @@ -1218,7 +1218,7 @@ transformFromClauseItem(ParseState *pstate, Node *n, ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), errmsg("TABLESAMPLE clause can only be applied to tables and materialized views"), - parser_errposition(pstate, exprLocation(rts->relation)))); + parser_errposition(pstate, exprLocation(rts->relation)))); /* Transform TABLESAMPLE details and attach to the RTE */ rte->tablesample = transformRangeTableSample(pstate, rts); @@ -1830,7 +1830,7 @@ checkTargetlistEntrySQL92(ParseState *pstate, TargetEntry *tle, errmsg("aggregate functions are not allowed in %s", ParseExprKindName(exprKind)), parser_errposition(pstate, - locate_agg_of_level((Node *) tle->expr, 0)))); + locate_agg_of_level((Node *) tle->expr, 0)))); if (pstate->p_hasWindowFuncs && contain_windowfuncs((Node *) tle->expr)) ereport(ERROR, @@ -1839,7 +1839,7 @@ checkTargetlistEntrySQL92(ParseState *pstate, TargetEntry *tle, errmsg("window functions are not allowed in %s", ParseExprKindName(exprKind)), parser_errposition(pstate, - locate_windowfunc((Node *) tle->expr)))); + locate_windowfunc((Node *) tle->expr)))); break; case EXPR_KIND_ORDER_BY: /* no extra checks needed */ @@ -2415,7 +2415,7 @@ transformGroupingSet(List **flatresult, List *l = transformGroupClauseList(flatresult, pstate, (List *) n, targetlist, sortClause, - exprKind, useSQL99, false); + exprKind, useSQL99, false); content = lappend(content, makeGroupingSet(GROUPING_SET_SIMPLE, l, @@ -2427,8 +2427,8 @@ transformGroupingSet(List **flatresult, content = lappend(content, transformGroupingSet(flatresult, pstate, gset2, - targetlist, sortClause, - exprKind, useSQL99, false)); + targetlist, sortClause, + exprKind, useSQL99, false)); } else { @@ -2530,7 +2530,7 @@ transformGroupClause(ParseState *pstate, List *grouplist, List **groupingSets, { flat_grouplist = list_make1(makeGroupingSet(GROUPING_SET_EMPTY, NIL, - exprLocation((Node *) grouplist))); + exprLocation((Node *) grouplist))); } foreach(gl, flat_grouplist) @@ -2556,8 +2556,8 @@ transformGroupClause(ParseState *pstate, List *grouplist, List **groupingSets, gsets = lappend(gsets, transformGroupingSet(&result, pstate, gset, - targetlist, sortClause, - exprKind, useSQL99, true)); + targetlist, sortClause, + exprKind, useSQL99, true)); break; } } @@ -2566,7 +2566,7 @@ transformGroupClause(ParseState *pstate, List *grouplist, List **groupingSets, Index ref = transformGroupClauseExpr(&result, seen_local, pstate, gexpr, targetlist, sortClause, - exprKind, useSQL99, true); + exprKind, useSQL99, true); if (ref > 0) { @@ -2719,8 +2719,8 @@ transformWindowDefinitions(ParseState *pstate, if (partitionClause) ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), - errmsg("cannot override PARTITION BY clause of window \"%s\"", - windef->refname), + errmsg("cannot override PARTITION BY clause of window \"%s\"", + windef->refname), parser_errposition(pstate, windef->location))); wc->partitionClause = copyObject(refwc->partitionClause); } @@ -2731,8 +2731,8 @@ transformWindowDefinitions(ParseState *pstate, if (orderClause && refwc->orderClause) ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), - errmsg("cannot override ORDER BY clause of window \"%s\"", - windef->refname), + errmsg("cannot override ORDER BY clause of window \"%s\"", + windef->refname), parser_errposition(pstate, windef->location))); if (orderClause) { @@ -2767,8 +2767,8 @@ transformWindowDefinitions(ParseState *pstate, /* Else this clause is just OVER (foo), so say this: */ ereport(ERROR, (errcode(ERRCODE_WINDOWING_ERROR), - errmsg("cannot copy window \"%s\" because it has a frame clause", - windef->refname), + errmsg("cannot copy window \"%s\" because it has a frame clause", + windef->refname), errhint("Omit the parentheses in this OVER clause."), parser_errposition(pstate, windef->location))); } @@ -2868,7 +2868,7 @@ transformDistinctClause(ParseState *pstate, ereport(ERROR, (errcode(ERRCODE_SYNTAX_ERROR), is_agg ? - errmsg("an aggregate with DISTINCT must have at least one argument") : + errmsg("an aggregate with DISTINCT must have at least one argument") : errmsg("SELECT DISTINCT must have at least one column"))); return result; @@ -2937,9 +2937,9 @@ transformDistinctOnClause(ParseState *pstate, List *distinctlist, (errcode(ERRCODE_INVALID_COLUMN_REFERENCE), errmsg("SELECT DISTINCT ON expressions must match initial ORDER BY expressions"), parser_errposition(pstate, - get_matching_location(scl->tleSortGroupRef, - sortgrouprefs, - distinctlist)))); + get_matching_location(scl->tleSortGroupRef, + sortgrouprefs, + distinctlist)))); else result = lappend(result, copyObject(scl)); } @@ -3051,7 +3051,7 @@ resolve_unique_index_expr(ParseState *pstate, InferClause *infer, if (ielem->nulls_ordering != SORTBY_NULLS_DEFAULT) ereport(ERROR, (errcode(ERRCODE_INVALID_COLUMN_REFERENCE), - errmsg("NULLS FIRST/LAST is not allowed in ON CONFLICT clause"), + errmsg("NULLS FIRST/LAST is not allowed in ON CONFLICT clause"), parser_errposition(pstate, exprLocation((Node *) infer)))); @@ -3134,7 +3134,7 @@ transformOnConflictArbiter(ParseState *pstate, errmsg("ON CONFLICT DO UPDATE requires inference specification or constraint name"), errhint("For example, ON CONFLICT (column_name)."), parser_errposition(pstate, - exprLocation((Node *) onConflictClause)))); + exprLocation((Node *) onConflictClause)))); /* * To simplify certain aspects of its design, speculative insertion into @@ -3143,9 +3143,9 @@ transformOnConflictArbiter(ParseState *pstate, if (IsCatalogRelation(pstate->p_target_relation)) ereport(ERROR, (errcode(ERRCODE_FEATURE_NOT_SUPPORTED), - errmsg("ON CONFLICT is not supported with system catalog tables"), + errmsg("ON CONFLICT is not supported with system catalog tables"), parser_errposition(pstate, - exprLocation((Node *) onConflictClause)))); + exprLocation((Node *) onConflictClause)))); /* Same applies to table used by logical decoding as catalog table */ if (RelationIsUsedAsCatalogTable(pstate->p_target_relation)) @@ -3154,7 +3154,7 @@ transformOnConflictArbiter(ParseState *pstate, errmsg("ON CONFLICT is not supported on table \"%s\" used as a catalog table", RelationGetRelationName(pstate->p_target_relation)), parser_errposition(pstate, - exprLocation((Node *) onConflictClause)))); + exprLocation((Node *) onConflictClause)))); /* ON CONFLICT DO NOTHING does not require an inference clause */ if (infer) @@ -3172,7 +3172,7 @@ transformOnConflictArbiter(ParseState *pstate, if (infer->indexElems) *arbiterExpr = resolve_unique_index_expr(pstate, infer, - pstate->p_target_relation); + pstate->p_target_relation); /* * Handling inference WHERE clause (for partial unique index @@ -3277,8 +3277,8 @@ addTargetToSortList(ParseState *pstate, TargetEntry *tle, if (!OidIsValid(eqop)) ereport(ERROR, (errcode(ERRCODE_WRONG_OBJECT_TYPE), - errmsg("operator %s is not a valid ordering operator", - strVal(llast(sortby->useOp))), + errmsg("operator %s is not a valid ordering operator", + strVal(llast(sortby->useOp))), errhint("Ordering operators must be \"<\" or \">\" members of btree operator families."))); /* |