aboutsummaryrefslogtreecommitdiff
path: root/src/backend/utils/adt/ruleutils.c
diff options
context:
space:
mode:
authorTom Lane <tgl@sss.pgh.pa.us>2017-06-21 15:35:54 -0400
committerTom Lane <tgl@sss.pgh.pa.us>2017-06-21 15:35:54 -0400
commit382ceffdf7f620d8f2d50e451b4167d291ae2348 (patch)
treef558251492f2c6f86e3566f7a82f9d00509122c2 /src/backend/utils/adt/ruleutils.c
parentc7b8998ebbf310a156aa38022555a24d98fdbfb4 (diff)
downloadpostgresql-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/utils/adt/ruleutils.c')
-rw-r--r--src/backend/utils/adt/ruleutils.c62
1 files changed, 31 insertions, 31 deletions
diff --git a/src/backend/utils/adt/ruleutils.c b/src/backend/utils/adt/ruleutils.c
index b8ad47a20c8..18d9e27d1ed 100644
--- a/src/backend/utils/adt/ruleutils.c
+++ b/src/backend/utils/adt/ruleutils.c
@@ -925,7 +925,7 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty)
{
if (OidIsValid(trigrec->tgconstrrelid))
appendStringInfo(&buf, "FROM %s ",
- generate_relation_name(trigrec->tgconstrrelid, NIL));
+ generate_relation_name(trigrec->tgconstrrelid, NIL));
if (!trigrec->tgdeferrable)
appendStringInfoString(&buf, "NOT ");
appendStringInfoString(&buf, "DEFERRABLE INITIALLY ");
@@ -1309,7 +1309,7 @@ pg_get_indexdef_worker(Oid indexrelid, int colno,
{
/* Need parens if it's not a bare function call */
if (indexkey && IsA(indexkey, FuncExpr) &&
- ((FuncExpr *) indexkey)->funcformat == COERCE_EXPLICIT_CALL)
+ ((FuncExpr *) indexkey)->funcformat == COERCE_EXPLICIT_CALL)
appendStringInfoString(&buf, str);
else
appendStringInfo(&buf, "(%s)", str);
@@ -1477,7 +1477,7 @@ pg_get_statisticsobj_worker(Oid statextid, bool missing_ok)
nsp = get_namespace_name(statextrec->stxnamespace);
appendStringInfo(&buf, "CREATE STATISTICS %s",
quote_qualified_identifier(nsp,
- NameStr(statextrec->stxname)));
+ NameStr(statextrec->stxname)));
/*
* Decode the stxkind column so that we know which stats types to print.
@@ -1631,7 +1631,7 @@ pg_get_partkeydef_worker(Oid relid, int prettyFlags,
char *exprsString;
exprsDatum = SysCacheGetAttr(PARTRELID, tuple,
- Anum_pg_partitioned_table_partexprs, &isnull);
+ Anum_pg_partitioned_table_partexprs, &isnull);
Assert(!isnull);
exprsString = TextDatumGetCString(exprsDatum);
partexprs = (List *) stringToNode(exprsString);
@@ -2023,7 +2023,7 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand,
tblspc = get_rel_tablespace(indexId);
if (OidIsValid(tblspc))
appendStringInfo(&buf, " USING INDEX TABLESPACE %s",
- quote_identifier(get_tablespace_name(tblspc)));
+ quote_identifier(get_tablespace_name(tblspc)));
}
break;
@@ -2458,7 +2458,7 @@ pg_get_functiondef(PG_FUNCTION_ARGS)
print_function_trftypes(&buf, proctup);
appendStringInfo(&buf, "\n LANGUAGE %s\n",
- quote_identifier(get_language_name(proc->prolang, false)));
+ quote_identifier(get_language_name(proc->prolang, false)));
/* Emit some miscellaneous options on one line */
oldlen = buf.len;
@@ -5088,19 +5088,19 @@ get_select_query_def(Query *query, deparse_context *context,
break;
case LCS_FORKEYSHARE:
appendContextKeyword(context, " FOR KEY SHARE",
- -PRETTYINDENT_STD, PRETTYINDENT_STD, 0);
+ -PRETTYINDENT_STD, PRETTYINDENT_STD, 0);
break;
case LCS_FORSHARE:
appendContextKeyword(context, " FOR SHARE",
- -PRETTYINDENT_STD, PRETTYINDENT_STD, 0);
+ -PRETTYINDENT_STD, PRETTYINDENT_STD, 0);
break;
case LCS_FORNOKEYUPDATE:
appendContextKeyword(context, " FOR NO KEY UPDATE",
- -PRETTYINDENT_STD, PRETTYINDENT_STD, 0);
+ -PRETTYINDENT_STD, PRETTYINDENT_STD, 0);
break;
case LCS_FORUPDATE:
appendContextKeyword(context, " FOR UPDATE",
- -PRETTYINDENT_STD, PRETTYINDENT_STD, 0);
+ -PRETTYINDENT_STD, PRETTYINDENT_STD, 0);
break;
}
@@ -5956,8 +5956,8 @@ get_insert_query_def(Query *query, deparse_context *context)
* tle->resname, since resname will fail to track RENAME.
*/
appendStringInfoString(buf,
- quote_identifier(get_relid_attribute_name(rte->relid,
- tle->resno)));
+ quote_identifier(get_relid_attribute_name(rte->relid,
+ tle->resno)));
/*
* Print any indirection needed (subfields or subscripts), and strip
@@ -6237,7 +6237,7 @@ get_update_query_targetlist_def(Query *query, List *targetList,
cur_ma_sublink = (SubLink *) lfirst(next_ma_cell);
next_ma_cell = lnext(next_ma_cell);
remaining_ma_columns = count_nonjunk_tlist_entries(
- ((Query *) cur_ma_sublink->subselect)->targetList);
+ ((Query *) cur_ma_sublink->subselect)->targetList);
Assert(((Param *) expr)->paramid ==
((cur_ma_sublink->subLinkId << 16) | 1));
appendStringInfoChar(buf, '(');
@@ -6249,8 +6249,8 @@ get_update_query_targetlist_def(Query *query, List *targetList,
* tle->resname, since resname will fail to track RENAME.
*/
appendStringInfoString(buf,
- quote_identifier(get_relid_attribute_name(rte->relid,
- tle->resno)));
+ quote_identifier(get_relid_attribute_name(rte->relid,
+ tle->resno)));
/*
* Print any indirection needed (subfields or subscripts), and strip
@@ -7733,7 +7733,7 @@ get_rule_expr(Node *node, deparse_context *context,
appendStringInfo(buf, " %s %s (",
generate_operator_name(expr->opno,
exprType(arg1),
- get_base_element_type(exprType(arg2))),
+ get_base_element_type(exprType(arg2))),
expr->useOr ? "ANY" : "ALL");
get_rule_expr_paren(arg2, context, true, node);
@@ -7753,7 +7753,7 @@ get_rule_expr(Node *node, deparse_context *context,
((SubLink *) arg2)->subLinkType == EXPR_SUBLINK)
appendStringInfo(buf, "::%s",
format_type_with_typemod(exprType(arg2),
- exprTypmod(arg2)));
+ exprTypmod(arg2)));
appendStringInfoChar(buf, ')');
if (!PRETTY_PAREN(context))
appendStringInfoChar(buf, ')');
@@ -8111,7 +8111,7 @@ get_rule_expr(Node *node, deparse_context *context,
*/
if (arrayexpr->elements == NIL)
appendStringInfo(buf, "::%s",
- format_type_with_typemod(arrayexpr->array_typeid, -1));
+ format_type_with_typemod(arrayexpr->array_typeid, -1));
}
break;
@@ -8173,7 +8173,7 @@ get_rule_expr(Node *node, deparse_context *context,
appendStringInfoChar(buf, ')');
if (rowexpr->row_format == COERCE_EXPLICIT_CAST)
appendStringInfo(buf, "::%s",
- format_type_with_typemod(rowexpr->row_typeid, -1));
+ format_type_with_typemod(rowexpr->row_typeid, -1));
}
break;
@@ -8206,9 +8206,9 @@ get_rule_expr(Node *node, deparse_context *context,
* be perfect.
*/
appendStringInfo(buf, ") %s ROW(",
- generate_operator_name(linitial_oid(rcexpr->opnos),
- exprType(linitial(rcexpr->largs)),
- exprType(linitial(rcexpr->rargs))));
+ generate_operator_name(linitial_oid(rcexpr->opnos),
+ exprType(linitial(rcexpr->largs)),
+ exprType(linitial(rcexpr->rargs))));
sep = "";
foreach(arg, rcexpr->rargs)
{
@@ -8406,7 +8406,7 @@ get_rule_expr(Node *node, deparse_context *context,
Assert(!con->constisnull);
if (DatumGetBool(con->constvalue))
appendStringInfoString(buf,
- " PRESERVE WHITESPACE");
+ " PRESERVE WHITESPACE");
else
appendStringInfoString(buf,
" STRIP WHITESPACE");
@@ -8434,15 +8434,15 @@ get_rule_expr(Node *node, deparse_context *context,
{
case XML_STANDALONE_YES:
appendStringInfoString(buf,
- ", STANDALONE YES");
+ ", STANDALONE YES");
break;
case XML_STANDALONE_NO:
appendStringInfoString(buf,
- ", STANDALONE NO");
+ ", STANDALONE NO");
break;
case XML_STANDALONE_NO_VALUE:
appendStringInfoString(buf,
- ", STANDALONE NO VALUE");
+ ", STANDALONE NO VALUE");
break;
default:
break;
@@ -8628,7 +8628,7 @@ get_rule_expr(Node *node, deparse_context *context,
if (iexpr->infercollid)
appendStringInfo(buf, " COLLATE %s",
- generate_collation_name(iexpr->infercollid));
+ generate_collation_name(iexpr->infercollid));
/* Add the operator class name, if not default */
if (iexpr->inferopclass)
@@ -9400,8 +9400,8 @@ get_sublink_expr(SubLink *sublink, deparse_context *context)
get_rule_expr(linitial(opexpr->args), context, true);
if (!opname)
opname = generate_operator_name(opexpr->opno,
- exprType(linitial(opexpr->args)),
- exprType(lsecond(opexpr->args)));
+ exprType(linitial(opexpr->args)),
+ exprType(lsecond(opexpr->args)));
sep = ", ";
}
appendStringInfoChar(buf, ')');
@@ -9415,7 +9415,7 @@ get_sublink_expr(SubLink *sublink, deparse_context *context)
get_rule_expr((Node *) rcexpr->largs, context, true);
opname = generate_operator_name(linitial_oid(rcexpr->opnos),
exprType(linitial(rcexpr->largs)),
- exprType(linitial(rcexpr->rargs)));
+ exprType(linitial(rcexpr->rargs)));
appendStringInfoChar(buf, ')');
}
else
@@ -10216,7 +10216,7 @@ processIndirection(Node *node, deparse_context *context)
*/
Assert(list_length(fstore->fieldnums) == 1);
fieldname = get_relid_attribute_name(typrelid,
- linitial_int(fstore->fieldnums));
+ linitial_int(fstore->fieldnums));
appendStringInfo(buf, ".%s", quote_identifier(fieldname));
/*