1
0
mirror of https://github.com/postgres/postgres.git synced 2025-06-11 20:28:21 +03:00

Fix up some misusage of appendStringInfo() and friends

Change to appendStringInfoChar() or appendStringInfoString() where those
can be used.

Author: David Rowley <david.rowley@2ndquadrant.com>
Reviewed-by: Ashutosh Bapat <ashutosh.bapat@enterprisedb.com>
This commit is contained in:
Peter Eisentraut
2017-08-15 23:34:39 -04:00
parent 4d4c891715
commit 77d05706be
13 changed files with 55 additions and 56 deletions

View File

@ -973,7 +973,7 @@ deparseSelectStmtForRel(StringInfo buf, PlannerInfo *root, RelOptInfo *rel,
/* Append HAVING clause */
if (remote_conds)
{
appendStringInfo(buf, " HAVING ");
appendStringInfoString(buf, " HAVING ");
appendConditions(remote_conds, &context);
}
}
@ -1076,7 +1076,7 @@ deparseFromExpr(List *quals, deparse_expr_cxt *context)
/* Construct WHERE clause */
if (quals != NIL)
{
appendStringInfo(buf, " WHERE ");
appendStringInfoString(buf, " WHERE ");
appendConditions(quals, context);
}
}
@ -1447,15 +1447,15 @@ deparseFromExprForRel(StringInfo buf, PlannerInfo *root, RelOptInfo *foreignrel,
context.root = root;
context.params_list = params_list;
appendStringInfo(buf, "(");
appendStringInfoChar(buf, '(');
appendConditions(fpinfo->joinclauses, &context);
appendStringInfo(buf, ")");
appendStringInfoChar(buf, ')');
}
else
appendStringInfoString(buf, "(TRUE)");
/* End the FROM clause entry. */
appendStringInfo(buf, ")");
appendStringInfoChar(buf, ')');
}
else
{
@ -1702,7 +1702,7 @@ deparseDirectUpdateSql(StringInfo buf, PlannerInfo *root,
if (remote_conds)
{
appendStringInfo(buf, " WHERE ");
appendStringInfoString(buf, " WHERE ");
appendConditions(remote_conds, &context);
}
@ -1762,7 +1762,7 @@ deparseDirectDeleteSql(StringInfo buf, PlannerInfo *root,
if (remote_conds)
{
appendStringInfo(buf, " WHERE ");
appendStringInfoString(buf, " WHERE ");
appendConditions(remote_conds, &context);
}
@ -1978,17 +1978,17 @@ deparseColumnRef(StringInfo buf, int varno, int varattno, PlannerInfo *root,
{
appendStringInfoString(buf, "CASE WHEN (");
ADD_REL_QUALIFIER(buf, varno);
appendStringInfo(buf, "*)::text IS NOT NULL THEN ");
appendStringInfoString(buf, "*)::text IS NOT NULL THEN ");
}
appendStringInfoString(buf, "ROW(");
deparseTargetList(buf, root, varno, rel, false, attrs_used, qualify_col,
&retrieved_attrs);
appendStringInfoString(buf, ")");
appendStringInfoChar(buf, ')');
/* Complete the CASE WHEN statement started above. */
if (qualify_col)
appendStringInfo(buf, " END");
appendStringInfoString(buf, " END");
heap_close(rel, NoLock);
bms_free(attrs_used);
@ -2759,7 +2759,7 @@ deparseAggref(Aggref *node, deparse_expr_cxt *context)
appendStringInfoChar(buf, '(');
/* Add DISTINCT */
appendStringInfo(buf, "%s", (node->aggdistinct != NIL) ? "DISTINCT " : "");
appendStringInfoString(buf, (node->aggdistinct != NIL) ? "DISTINCT " : "");
if (AGGKIND_IS_ORDERED_SET(node->aggkind))
{
@ -2944,7 +2944,7 @@ appendGroupByClause(List *tlist, deparse_expr_cxt *context)
if (!query->groupClause)
return;
appendStringInfo(buf, " GROUP BY ");
appendStringInfoString(buf, " GROUP BY ");
/*
* Queries with grouping sets are not pushed down, so we don't expect
@ -2981,7 +2981,7 @@ appendOrderByClause(List *pathkeys, deparse_expr_cxt *context)
/* Make sure any constants in the exprs are printed portably */
nestlevel = set_transmission_modes();
appendStringInfo(buf, " ORDER BY");
appendStringInfoString(buf, " ORDER BY");
foreach(lcell, pathkeys)
{
PathKey *pathkey = lfirst(lcell);
@ -3035,7 +3035,7 @@ appendFunctionName(Oid funcid, deparse_expr_cxt *context)
/* Always print the function name */
proname = NameStr(procform->proname);
appendStringInfo(buf, "%s", quote_identifier(proname));
appendStringInfoString(buf, quote_identifier(proname));
ReleaseSysCache(proctup);
}
@ -3070,9 +3070,9 @@ deparseSortGroupClause(Index ref, List *tlist, deparse_expr_cxt *context)
else
{
/* Always parenthesize the expression. */
appendStringInfoString(buf, "(");
appendStringInfoChar(buf, '(');
deparseExpr(expr, context);
appendStringInfoString(buf, ")");
appendStringInfoChar(buf, ')');
}
return (Node *) expr;