mirror of
https://github.com/postgres/postgres.git
synced 2025-06-13 07:41:39 +03:00
Use appendStringInfoString instead of appendStringInfo where possible.
This shaves a few cycles, and generally seems like good programming practice. David Rowley
This commit is contained in:
@ -483,7 +483,7 @@ pg_get_ruledef_worker(Oid ruleoid, int prettyFlags)
|
||||
if (spirc != SPI_OK_SELECT)
|
||||
elog(ERROR, "failed to get pg_rewrite tuple for rule %u", ruleoid);
|
||||
if (SPI_processed != 1)
|
||||
appendStringInfo(&buf, "-");
|
||||
appendStringInfoChar(&buf, '-');
|
||||
else
|
||||
{
|
||||
/*
|
||||
@ -638,7 +638,7 @@ pg_get_viewdef_worker(Oid viewoid, int prettyFlags, int wrapColumn)
|
||||
if (spirc != SPI_OK_SELECT)
|
||||
elog(ERROR, "failed to get pg_rewrite tuple for view %u", viewoid);
|
||||
if (SPI_processed != 1)
|
||||
appendStringInfo(&buf, "Not a view");
|
||||
appendStringInfoString(&buf, "Not a view");
|
||||
else
|
||||
{
|
||||
/*
|
||||
@ -725,33 +725,33 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty)
|
||||
quote_identifier(tgname));
|
||||
|
||||
if (TRIGGER_FOR_BEFORE(trigrec->tgtype))
|
||||
appendStringInfo(&buf, "BEFORE");
|
||||
appendStringInfoString(&buf, "BEFORE");
|
||||
else if (TRIGGER_FOR_AFTER(trigrec->tgtype))
|
||||
appendStringInfo(&buf, "AFTER");
|
||||
appendStringInfoString(&buf, "AFTER");
|
||||
else if (TRIGGER_FOR_INSTEAD(trigrec->tgtype))
|
||||
appendStringInfo(&buf, "INSTEAD OF");
|
||||
appendStringInfoString(&buf, "INSTEAD OF");
|
||||
else
|
||||
elog(ERROR, "unexpected tgtype value: %d", trigrec->tgtype);
|
||||
|
||||
if (TRIGGER_FOR_INSERT(trigrec->tgtype))
|
||||
{
|
||||
appendStringInfo(&buf, " INSERT");
|
||||
appendStringInfoString(&buf, " INSERT");
|
||||
findx++;
|
||||
}
|
||||
if (TRIGGER_FOR_DELETE(trigrec->tgtype))
|
||||
{
|
||||
if (findx > 0)
|
||||
appendStringInfo(&buf, " OR DELETE");
|
||||
appendStringInfoString(&buf, " OR DELETE");
|
||||
else
|
||||
appendStringInfo(&buf, " DELETE");
|
||||
appendStringInfoString(&buf, " DELETE");
|
||||
findx++;
|
||||
}
|
||||
if (TRIGGER_FOR_UPDATE(trigrec->tgtype))
|
||||
{
|
||||
if (findx > 0)
|
||||
appendStringInfo(&buf, " OR UPDATE");
|
||||
appendStringInfoString(&buf, " OR UPDATE");
|
||||
else
|
||||
appendStringInfo(&buf, " UPDATE");
|
||||
appendStringInfoString(&buf, " UPDATE");
|
||||
findx++;
|
||||
/* tgattr is first var-width field, so OK to access directly */
|
||||
if (trigrec->tgattr.dim1 > 0)
|
||||
@ -774,9 +774,9 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty)
|
||||
if (TRIGGER_FOR_TRUNCATE(trigrec->tgtype))
|
||||
{
|
||||
if (findx > 0)
|
||||
appendStringInfo(&buf, " OR TRUNCATE");
|
||||
appendStringInfoString(&buf, " OR TRUNCATE");
|
||||
else
|
||||
appendStringInfo(&buf, " TRUNCATE");
|
||||
appendStringInfoString(&buf, " TRUNCATE");
|
||||
findx++;
|
||||
}
|
||||
appendStringInfo(&buf, " ON %s ",
|
||||
@ -788,18 +788,18 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty)
|
||||
appendStringInfo(&buf, "FROM %s ",
|
||||
generate_relation_name(trigrec->tgconstrrelid, NIL));
|
||||
if (!trigrec->tgdeferrable)
|
||||
appendStringInfo(&buf, "NOT ");
|
||||
appendStringInfo(&buf, "DEFERRABLE INITIALLY ");
|
||||
appendStringInfoString(&buf, "NOT ");
|
||||
appendStringInfoString(&buf, "DEFERRABLE INITIALLY ");
|
||||
if (trigrec->tginitdeferred)
|
||||
appendStringInfo(&buf, "DEFERRED ");
|
||||
appendStringInfoString(&buf, "DEFERRED ");
|
||||
else
|
||||
appendStringInfo(&buf, "IMMEDIATE ");
|
||||
appendStringInfoString(&buf, "IMMEDIATE ");
|
||||
}
|
||||
|
||||
if (TRIGGER_FOR_ROW(trigrec->tgtype))
|
||||
appendStringInfo(&buf, "FOR EACH ROW ");
|
||||
appendStringInfoString(&buf, "FOR EACH ROW ");
|
||||
else
|
||||
appendStringInfo(&buf, "FOR EACH STATEMENT ");
|
||||
appendStringInfoString(&buf, "FOR EACH STATEMENT ");
|
||||
|
||||
/* If the trigger has a WHEN qualification, add that */
|
||||
value = fastgetattr(ht_trig, Anum_pg_trigger_tgqual,
|
||||
@ -859,7 +859,7 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty)
|
||||
|
||||
get_rule_expr(qual, &context, false);
|
||||
|
||||
appendStringInfo(&buf, ") ");
|
||||
appendStringInfoString(&buf, ") ");
|
||||
}
|
||||
|
||||
appendStringInfo(&buf, "EXECUTE PROCEDURE %s(",
|
||||
@ -880,7 +880,7 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty)
|
||||
for (i = 0; i < trigrec->tgnargs; i++)
|
||||
{
|
||||
if (i > 0)
|
||||
appendStringInfo(&buf, ", ");
|
||||
appendStringInfoString(&buf, ", ");
|
||||
simple_quote_literal(&buf, p);
|
||||
/* advance p to next string embedded in tgargs */
|
||||
while (*p)
|
||||
@ -890,7 +890,7 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty)
|
||||
}
|
||||
|
||||
/* We deliberately do not put semi-colon at end */
|
||||
appendStringInfo(&buf, ")");
|
||||
appendStringInfoChar(&buf, ')');
|
||||
|
||||
/* Clean up */
|
||||
systable_endscan(tgscan);
|
||||
@ -1154,15 +1154,15 @@ pg_get_indexdef_worker(Oid indexrelid, int colno,
|
||||
/* if it supports sort ordering, report DESC and NULLS opts */
|
||||
if (opt & INDOPTION_DESC)
|
||||
{
|
||||
appendStringInfo(&buf, " DESC");
|
||||
appendStringInfoString(&buf, " DESC");
|
||||
/* NULLS FIRST is the default in this case */
|
||||
if (!(opt & INDOPTION_NULLS_FIRST))
|
||||
appendStringInfo(&buf, " NULLS LAST");
|
||||
appendStringInfoString(&buf, " NULLS LAST");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (opt & INDOPTION_NULLS_FIRST)
|
||||
appendStringInfo(&buf, " NULLS FIRST");
|
||||
appendStringInfoString(&buf, " NULLS FIRST");
|
||||
}
|
||||
}
|
||||
|
||||
@ -1312,7 +1312,7 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand,
|
||||
const char *string;
|
||||
|
||||
/* Start off the constraint definition */
|
||||
appendStringInfo(&buf, "FOREIGN KEY (");
|
||||
appendStringInfoString(&buf, "FOREIGN KEY (");
|
||||
|
||||
/* Fetch and build referencing-column list */
|
||||
val = SysCacheGetAttr(CONSTROID, tup,
|
||||
@ -1337,7 +1337,7 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand,
|
||||
|
||||
decompile_column_index_array(val, conForm->confrelid, &buf);
|
||||
|
||||
appendStringInfo(&buf, ")");
|
||||
appendStringInfoChar(&buf, ')');
|
||||
|
||||
/* Add match type */
|
||||
switch (conForm->confmatchtype)
|
||||
@ -1423,9 +1423,9 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand,
|
||||
|
||||
/* Start off the constraint definition */
|
||||
if (conForm->contype == CONSTRAINT_PRIMARY)
|
||||
appendStringInfo(&buf, "PRIMARY KEY (");
|
||||
appendStringInfoString(&buf, "PRIMARY KEY (");
|
||||
else
|
||||
appendStringInfo(&buf, "UNIQUE (");
|
||||
appendStringInfoString(&buf, "UNIQUE (");
|
||||
|
||||
/* Fetch and build target column list */
|
||||
val = SysCacheGetAttr(CONSTROID, tup,
|
||||
@ -1436,7 +1436,7 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand,
|
||||
|
||||
decompile_column_index_array(val, conForm->conrelid, &buf);
|
||||
|
||||
appendStringInfo(&buf, ")");
|
||||
appendStringInfoChar(&buf, ')');
|
||||
|
||||
indexId = get_constraint_index(constraintId);
|
||||
|
||||
@ -1520,7 +1520,7 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand,
|
||||
* throw an error; if we throw error then this function couldn't
|
||||
* safely be applied to all rows of pg_constraint.
|
||||
*/
|
||||
appendStringInfo(&buf, "TRIGGER");
|
||||
appendStringInfoString(&buf, "TRIGGER");
|
||||
break;
|
||||
case CONSTRAINT_EXCLUSION:
|
||||
{
|
||||
@ -1565,9 +1565,9 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand,
|
||||
}
|
||||
|
||||
if (conForm->condeferrable)
|
||||
appendStringInfo(&buf, " DEFERRABLE");
|
||||
appendStringInfoString(&buf, " DEFERRABLE");
|
||||
if (conForm->condeferred)
|
||||
appendStringInfo(&buf, " INITIALLY DEFERRED");
|
||||
appendStringInfoString(&buf, " INITIALLY DEFERRED");
|
||||
if (!conForm->convalidated)
|
||||
appendStringInfoString(&buf, " NOT VALID");
|
||||
|
||||
@ -2029,7 +2029,7 @@ pg_get_functiondef(PG_FUNCTION_ARGS)
|
||||
appendStringInfoString(&buf, prosrc);
|
||||
appendStringInfoString(&buf, dq.data);
|
||||
|
||||
appendStringInfoString(&buf, "\n");
|
||||
appendStringInfoChar(&buf, '\n');
|
||||
|
||||
ReleaseSysCache(langtup);
|
||||
ReleaseSysCache(proctup);
|
||||
@ -3789,19 +3789,19 @@ make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
|
||||
switch (ev_type)
|
||||
{
|
||||
case '1':
|
||||
appendStringInfo(buf, "SELECT");
|
||||
appendStringInfoString(buf, "SELECT");
|
||||
break;
|
||||
|
||||
case '2':
|
||||
appendStringInfo(buf, "UPDATE");
|
||||
appendStringInfoString(buf, "UPDATE");
|
||||
break;
|
||||
|
||||
case '3':
|
||||
appendStringInfo(buf, "INSERT");
|
||||
appendStringInfoString(buf, "INSERT");
|
||||
break;
|
||||
|
||||
case '4':
|
||||
appendStringInfo(buf, "DELETE");
|
||||
appendStringInfoString(buf, "DELETE");
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -3827,7 +3827,7 @@ make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
|
||||
|
||||
if (prettyFlags & PRETTYFLAG_INDENT)
|
||||
appendStringInfoString(buf, "\n ");
|
||||
appendStringInfo(buf, " WHERE ");
|
||||
appendStringInfoString(buf, " WHERE ");
|
||||
|
||||
qual = stringToNode(ev_qual);
|
||||
|
||||
@ -3862,11 +3862,11 @@ make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
|
||||
get_rule_expr(qual, &context, false);
|
||||
}
|
||||
|
||||
appendStringInfo(buf, " DO ");
|
||||
appendStringInfoString(buf, " DO ");
|
||||
|
||||
/* The INSTEAD keyword (if so) */
|
||||
if (is_instead)
|
||||
appendStringInfo(buf, "INSTEAD ");
|
||||
appendStringInfoString(buf, "INSTEAD ");
|
||||
|
||||
/* Finally the rules actions */
|
||||
if (list_length(actions) > 1)
|
||||
@ -3874,22 +3874,22 @@ make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
|
||||
ListCell *action;
|
||||
Query *query;
|
||||
|
||||
appendStringInfo(buf, "(");
|
||||
appendStringInfoChar(buf, '(');
|
||||
foreach(action, actions)
|
||||
{
|
||||
query = (Query *) lfirst(action);
|
||||
get_query_def(query, buf, NIL, NULL,
|
||||
prettyFlags, WRAP_COLUMN_DEFAULT, 0);
|
||||
if (prettyFlags)
|
||||
appendStringInfo(buf, ";\n");
|
||||
appendStringInfoString(buf, ";\n");
|
||||
else
|
||||
appendStringInfo(buf, "; ");
|
||||
appendStringInfoString(buf, "; ");
|
||||
}
|
||||
appendStringInfo(buf, ");");
|
||||
appendStringInfoString(buf, ");");
|
||||
}
|
||||
else if (list_length(actions) == 0)
|
||||
{
|
||||
appendStringInfo(buf, "NOTHING;");
|
||||
appendStringInfoString(buf, "NOTHING;");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -3898,7 +3898,7 @@ make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
|
||||
query = (Query *) linitial(actions);
|
||||
get_query_def(query, buf, NIL, NULL,
|
||||
prettyFlags, WRAP_COLUMN_DEFAULT, 0);
|
||||
appendStringInfo(buf, ";");
|
||||
appendStringInfoChar(buf, ';');
|
||||
}
|
||||
}
|
||||
|
||||
@ -3945,7 +3945,7 @@ make_viewdef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
|
||||
|
||||
if (list_length(actions) != 1)
|
||||
{
|
||||
appendStringInfo(buf, "Not a view");
|
||||
appendStringInfoString(buf, "Not a view");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3954,7 +3954,7 @@ make_viewdef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
|
||||
if (ev_type != '1' || !is_instead ||
|
||||
strcmp(ev_qual, "<>") != 0 || query->commandType != CMD_SELECT)
|
||||
{
|
||||
appendStringInfo(buf, "Not a view");
|
||||
appendStringInfoString(buf, "Not a view");
|
||||
return;
|
||||
}
|
||||
|
||||
@ -3962,7 +3962,7 @@ make_viewdef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
|
||||
|
||||
get_query_def(query, buf, NIL, RelationGetDescr(ev_relation),
|
||||
prettyFlags, wrapColumn, 0);
|
||||
appendStringInfo(buf, ";");
|
||||
appendStringInfoChar(buf, ';');
|
||||
|
||||
heap_close(ev_relation, AccessShareLock);
|
||||
}
|
||||
@ -4022,7 +4022,7 @@ get_query_def(Query *query, StringInfo buf, List *parentnamespace,
|
||||
break;
|
||||
|
||||
case CMD_NOTHING:
|
||||
appendStringInfo(buf, "NOTHING");
|
||||
appendStringInfoString(buf, "NOTHING");
|
||||
break;
|
||||
|
||||
case CMD_UTILITY:
|
||||
@ -4211,7 +4211,7 @@ get_select_query_def(Query *query, deparse_context *context,
|
||||
-PRETTYINDENT_STD, PRETTYINDENT_STD, 0);
|
||||
if (IsA(query->limitCount, Const) &&
|
||||
((Const *) query->limitCount)->constisnull)
|
||||
appendStringInfo(buf, "ALL");
|
||||
appendStringInfoString(buf, "ALL");
|
||||
else
|
||||
get_rule_expr(query->limitCount, context, false);
|
||||
}
|
||||
@ -4251,7 +4251,7 @@ get_select_query_def(Query *query, deparse_context *context,
|
||||
quote_identifier(get_rtable_name(rc->rti,
|
||||
context)));
|
||||
if (rc->noWait)
|
||||
appendStringInfo(buf, " NOWAIT");
|
||||
appendStringInfoString(buf, " NOWAIT");
|
||||
}
|
||||
}
|
||||
|
||||
@ -4325,14 +4325,14 @@ get_basic_select_query(Query *query, deparse_context *context,
|
||||
/*
|
||||
* Build up the query string - first we say SELECT
|
||||
*/
|
||||
appendStringInfo(buf, "SELECT");
|
||||
appendStringInfoString(buf, "SELECT");
|
||||
|
||||
/* Add the DISTINCT clause if given */
|
||||
if (query->distinctClause != NIL)
|
||||
{
|
||||
if (query->hasDistinctOn)
|
||||
{
|
||||
appendStringInfo(buf, " DISTINCT ON (");
|
||||
appendStringInfoString(buf, " DISTINCT ON (");
|
||||
sep = "";
|
||||
foreach(l, query->distinctClause)
|
||||
{
|
||||
@ -4343,10 +4343,10 @@ get_basic_select_query(Query *query, deparse_context *context,
|
||||
false, context);
|
||||
sep = ", ";
|
||||
}
|
||||
appendStringInfo(buf, ")");
|
||||
appendStringInfoChar(buf, ')');
|
||||
}
|
||||
else
|
||||
appendStringInfo(buf, " DISTINCT");
|
||||
appendStringInfoString(buf, " DISTINCT");
|
||||
}
|
||||
|
||||
/* Then we tell what to select (the targetlist) */
|
||||
@ -4603,7 +4603,7 @@ get_setop_query(Node *setOp, Query *query, deparse_context *context,
|
||||
(int) op->op);
|
||||
}
|
||||
if (op->all)
|
||||
appendStringInfo(buf, "ALL ");
|
||||
appendStringInfoString(buf, "ALL ");
|
||||
|
||||
if (PRETTY_INDENT(context))
|
||||
appendContextKeyword(context, "", 0, 0, 0);
|
||||
@ -4693,14 +4693,14 @@ get_rule_orderby(List *orderList, List *targetList,
|
||||
{
|
||||
/* ASC is default, so emit nothing for it */
|
||||
if (srt->nulls_first)
|
||||
appendStringInfo(buf, " NULLS FIRST");
|
||||
appendStringInfoString(buf, " NULLS FIRST");
|
||||
}
|
||||
else if (srt->sortop == typentry->gt_opr)
|
||||
{
|
||||
appendStringInfo(buf, " DESC");
|
||||
appendStringInfoString(buf, " DESC");
|
||||
/* DESC defaults to NULLS FIRST */
|
||||
if (!srt->nulls_first)
|
||||
appendStringInfo(buf, " NULLS LAST");
|
||||
appendStringInfoString(buf, " NULLS LAST");
|
||||
}
|
||||
else
|
||||
{
|
||||
@ -4710,9 +4710,9 @@ get_rule_orderby(List *orderList, List *targetList,
|
||||
sortcoltype));
|
||||
/* be specific to eliminate ambiguity */
|
||||
if (srt->nulls_first)
|
||||
appendStringInfo(buf, " NULLS FIRST");
|
||||
appendStringInfoString(buf, " NULLS FIRST");
|
||||
else
|
||||
appendStringInfo(buf, " NULLS LAST");
|
||||
appendStringInfoString(buf, " NULLS LAST");
|
||||
}
|
||||
sep = ", ";
|
||||
}
|
||||
@ -4964,7 +4964,7 @@ get_insert_query_def(Query *query, deparse_context *context)
|
||||
}
|
||||
}
|
||||
if (query->targetList)
|
||||
appendStringInfo(buf, ") ");
|
||||
appendStringInfoString(buf, ") ");
|
||||
|
||||
if (select_rte)
|
||||
{
|
||||
@ -4989,7 +4989,7 @@ get_insert_query_def(Query *query, deparse_context *context)
|
||||
else
|
||||
{
|
||||
/* No expressions, so it must be DEFAULT VALUES */
|
||||
appendStringInfo(buf, "DEFAULT VALUES");
|
||||
appendStringInfoString(buf, "DEFAULT VALUES");
|
||||
}
|
||||
|
||||
/* Add RETURNING if present */
|
||||
@ -5062,7 +5062,7 @@ get_update_query_def(Query *query, deparse_context *context)
|
||||
*/
|
||||
expr = processIndirection((Node *) tle->expr, context, true);
|
||||
|
||||
appendStringInfo(buf, " = ");
|
||||
appendStringInfoString(buf, " = ");
|
||||
|
||||
get_rule_expr(expr, context, false);
|
||||
}
|
||||
@ -6426,7 +6426,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
||||
if (!PRETTY_PAREN(context))
|
||||
appendStringInfoChar(buf, '(');
|
||||
get_rule_expr_paren(arg1, context, true, node);
|
||||
appendStringInfo(buf, " IS DISTINCT FROM ");
|
||||
appendStringInfoString(buf, " IS DISTINCT FROM ");
|
||||
get_rule_expr_paren(arg2, context, true, node);
|
||||
if (!PRETTY_PAREN(context))
|
||||
appendStringInfoChar(buf, ')');
|
||||
@ -6437,7 +6437,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
||||
{
|
||||
NullIfExpr *nullifexpr = (NullIfExpr *) node;
|
||||
|
||||
appendStringInfo(buf, "NULLIF(");
|
||||
appendStringInfoString(buf, "NULLIF(");
|
||||
get_rule_expr((Node *) nullifexpr->args, context, true);
|
||||
appendStringInfoChar(buf, ')');
|
||||
}
|
||||
@ -6480,7 +6480,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
||||
false, node);
|
||||
while (arg)
|
||||
{
|
||||
appendStringInfo(buf, " AND ");
|
||||
appendStringInfoString(buf, " AND ");
|
||||
get_rule_expr_paren((Node *) lfirst(arg), context,
|
||||
false, node);
|
||||
arg = lnext(arg);
|
||||
@ -6496,7 +6496,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
||||
false, node);
|
||||
while (arg)
|
||||
{
|
||||
appendStringInfo(buf, " OR ");
|
||||
appendStringInfoString(buf, " OR ");
|
||||
get_rule_expr_paren((Node *) lfirst(arg), context,
|
||||
false, node);
|
||||
arg = lnext(arg);
|
||||
@ -6508,7 +6508,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
||||
case NOT_EXPR:
|
||||
if (!PRETTY_PAREN(context))
|
||||
appendStringInfoChar(buf, '(');
|
||||
appendStringInfo(buf, "NOT ");
|
||||
appendStringInfoString(buf, "NOT ");
|
||||
get_rule_expr_paren(first_arg, context,
|
||||
false, node);
|
||||
if (!PRETTY_PAREN(context))
|
||||
@ -6549,7 +6549,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
||||
ListCell *lc;
|
||||
|
||||
/* As above, this can only happen during EXPLAIN */
|
||||
appendStringInfo(buf, "(alternatives: ");
|
||||
appendStringInfoString(buf, "(alternatives: ");
|
||||
foreach(lc, asplan->subplans)
|
||||
{
|
||||
SubPlan *splan = (SubPlan *) lfirst(lc);
|
||||
@ -6558,11 +6558,11 @@ get_rule_expr(Node *node, deparse_context *context,
|
||||
if (splan->useHashTable)
|
||||
appendStringInfo(buf, "hashed %s", splan->plan_name);
|
||||
else
|
||||
appendStringInfo(buf, "%s", splan->plan_name);
|
||||
appendStringInfoString(buf, splan->plan_name);
|
||||
if (lnext(lc))
|
||||
appendStringInfo(buf, " or ");
|
||||
appendStringInfoString(buf, " or ");
|
||||
}
|
||||
appendStringInfo(buf, ")");
|
||||
appendStringInfoChar(buf, ')');
|
||||
}
|
||||
break;
|
||||
|
||||
@ -6774,7 +6774,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
||||
appendContextKeyword(context, "WHEN ",
|
||||
0, 0, 0);
|
||||
get_rule_expr(w, context, false);
|
||||
appendStringInfo(buf, " THEN ");
|
||||
appendStringInfoString(buf, " THEN ");
|
||||
get_rule_expr((Node *) when->result, context, true);
|
||||
}
|
||||
if (!PRETTY_INDENT(context))
|
||||
@ -6798,7 +6798,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
||||
* be unable to avoid that (see comments for CaseExpr). If we
|
||||
* do see one, print it as CASE_TEST_EXPR.
|
||||
*/
|
||||
appendStringInfo(buf, "CASE_TEST_EXPR");
|
||||
appendStringInfoString(buf, "CASE_TEST_EXPR");
|
||||
}
|
||||
break;
|
||||
|
||||
@ -6806,7 +6806,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
||||
{
|
||||
ArrayExpr *arrayexpr = (ArrayExpr *) node;
|
||||
|
||||
appendStringInfo(buf, "ARRAY[");
|
||||
appendStringInfoString(buf, "ARRAY[");
|
||||
get_rule_expr((Node *) arrayexpr->elements, context, true);
|
||||
appendStringInfoChar(buf, ']');
|
||||
|
||||
@ -6844,7 +6844,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
||||
* SQL99 allows "ROW" to be omitted when there is more than
|
||||
* one column, but for simplicity we always print it.
|
||||
*/
|
||||
appendStringInfo(buf, "ROW(");
|
||||
appendStringInfoString(buf, "ROW(");
|
||||
sep = "";
|
||||
i = 0;
|
||||
foreach(arg, rowexpr->args)
|
||||
@ -6867,7 +6867,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
||||
if (!tupdesc->attrs[i]->attisdropped)
|
||||
{
|
||||
appendStringInfoString(buf, sep);
|
||||
appendStringInfo(buf, "NULL");
|
||||
appendStringInfoString(buf, "NULL");
|
||||
sep = ", ";
|
||||
}
|
||||
i++;
|
||||
@ -6875,7 +6875,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
||||
|
||||
ReleaseTupleDesc(tupdesc);
|
||||
}
|
||||
appendStringInfo(buf, ")");
|
||||
appendStringInfoChar(buf, ')');
|
||||
if (rowexpr->row_format == COERCE_EXPLICIT_CAST)
|
||||
appendStringInfo(buf, "::%s",
|
||||
format_type_with_typemod(rowexpr->row_typeid, -1));
|
||||
@ -6892,7 +6892,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
||||
* SQL99 allows "ROW" to be omitted when there is more than
|
||||
* one column, but for simplicity we always print it.
|
||||
*/
|
||||
appendStringInfo(buf, "(ROW(");
|
||||
appendStringInfoString(buf, "(ROW(");
|
||||
sep = "";
|
||||
foreach(arg, rcexpr->largs)
|
||||
{
|
||||
@ -6923,7 +6923,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
||||
get_rule_expr(e, context, true);
|
||||
sep = ", ";
|
||||
}
|
||||
appendStringInfo(buf, "))");
|
||||
appendStringInfoString(buf, "))");
|
||||
}
|
||||
break;
|
||||
|
||||
@ -6931,7 +6931,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
||||
{
|
||||
CoalesceExpr *coalesceexpr = (CoalesceExpr *) node;
|
||||
|
||||
appendStringInfo(buf, "COALESCE(");
|
||||
appendStringInfoString(buf, "COALESCE(");
|
||||
get_rule_expr((Node *) coalesceexpr->args, context, true);
|
||||
appendStringInfoChar(buf, ')');
|
||||
}
|
||||
@ -6944,10 +6944,10 @@ get_rule_expr(Node *node, deparse_context *context,
|
||||
switch (minmaxexpr->op)
|
||||
{
|
||||
case IS_GREATEST:
|
||||
appendStringInfo(buf, "GREATEST(");
|
||||
appendStringInfoString(buf, "GREATEST(");
|
||||
break;
|
||||
case IS_LEAST:
|
||||
appendStringInfo(buf, "LEAST(");
|
||||
appendStringInfoString(buf, "LEAST(");
|
||||
break;
|
||||
}
|
||||
get_rule_expr((Node *) minmaxexpr->args, context, true);
|
||||
@ -7122,10 +7122,10 @@ get_rule_expr(Node *node, deparse_context *context,
|
||||
switch (ntest->nulltesttype)
|
||||
{
|
||||
case IS_NULL:
|
||||
appendStringInfo(buf, " IS NULL");
|
||||
appendStringInfoString(buf, " IS NULL");
|
||||
break;
|
||||
case IS_NOT_NULL:
|
||||
appendStringInfo(buf, " IS NOT NULL");
|
||||
appendStringInfoString(buf, " IS NOT NULL");
|
||||
break;
|
||||
default:
|
||||
elog(ERROR, "unrecognized nulltesttype: %d",
|
||||
@ -7146,22 +7146,22 @@ get_rule_expr(Node *node, deparse_context *context,
|
||||
switch (btest->booltesttype)
|
||||
{
|
||||
case IS_TRUE:
|
||||
appendStringInfo(buf, " IS TRUE");
|
||||
appendStringInfoString(buf, " IS TRUE");
|
||||
break;
|
||||
case IS_NOT_TRUE:
|
||||
appendStringInfo(buf, " IS NOT TRUE");
|
||||
appendStringInfoString(buf, " IS NOT TRUE");
|
||||
break;
|
||||
case IS_FALSE:
|
||||
appendStringInfo(buf, " IS FALSE");
|
||||
appendStringInfoString(buf, " IS FALSE");
|
||||
break;
|
||||
case IS_NOT_FALSE:
|
||||
appendStringInfo(buf, " IS NOT FALSE");
|
||||
appendStringInfoString(buf, " IS NOT FALSE");
|
||||
break;
|
||||
case IS_UNKNOWN:
|
||||
appendStringInfo(buf, " IS UNKNOWN");
|
||||
appendStringInfoString(buf, " IS UNKNOWN");
|
||||
break;
|
||||
case IS_NOT_UNKNOWN:
|
||||
appendStringInfo(buf, " IS NOT UNKNOWN");
|
||||
appendStringInfoString(buf, " IS NOT UNKNOWN");
|
||||
break;
|
||||
default:
|
||||
elog(ERROR, "unrecognized booltesttype: %d",
|
||||
@ -7194,11 +7194,11 @@ get_rule_expr(Node *node, deparse_context *context,
|
||||
break;
|
||||
|
||||
case T_CoerceToDomainValue:
|
||||
appendStringInfo(buf, "VALUE");
|
||||
appendStringInfoString(buf, "VALUE");
|
||||
break;
|
||||
|
||||
case T_SetToDefault:
|
||||
appendStringInfo(buf, "DEFAULT");
|
||||
appendStringInfoString(buf, "DEFAULT");
|
||||
break;
|
||||
|
||||
case T_CurrentOfExpr:
|
||||
@ -7592,7 +7592,7 @@ get_const_expr(Const *constval, deparse_context *context, int showtype)
|
||||
* Always label the type of a NULL constant to prevent misdecisions
|
||||
* about type when reparsing.
|
||||
*/
|
||||
appendStringInfo(buf, "NULL");
|
||||
appendStringInfoString(buf, "NULL");
|
||||
if (showtype >= 0)
|
||||
{
|
||||
appendStringInfo(buf, "::%s",
|
||||
@ -7654,9 +7654,9 @@ get_const_expr(Const *constval, deparse_context *context, int showtype)
|
||||
|
||||
case BOOLOID:
|
||||
if (strcmp(extval, "t") == 0)
|
||||
appendStringInfo(buf, "true");
|
||||
appendStringInfoString(buf, "true");
|
||||
else
|
||||
appendStringInfo(buf, "false");
|
||||
appendStringInfoString(buf, "false");
|
||||
break;
|
||||
|
||||
default:
|
||||
@ -7763,7 +7763,7 @@ get_sublink_expr(SubLink *sublink, deparse_context *context)
|
||||
bool need_paren;
|
||||
|
||||
if (sublink->subLinkType == ARRAY_SUBLINK)
|
||||
appendStringInfo(buf, "ARRAY(");
|
||||
appendStringInfoString(buf, "ARRAY(");
|
||||
else
|
||||
appendStringInfoChar(buf, '(');
|
||||
|
||||
@ -7831,12 +7831,12 @@ get_sublink_expr(SubLink *sublink, deparse_context *context)
|
||||
switch (sublink->subLinkType)
|
||||
{
|
||||
case EXISTS_SUBLINK:
|
||||
appendStringInfo(buf, "EXISTS ");
|
||||
appendStringInfoString(buf, "EXISTS ");
|
||||
break;
|
||||
|
||||
case ANY_SUBLINK:
|
||||
if (strcmp(opname, "=") == 0) /* Represent = ANY as IN */
|
||||
appendStringInfo(buf, " IN ");
|
||||
appendStringInfoString(buf, " IN ");
|
||||
else
|
||||
appendStringInfo(buf, " %s ANY ", opname);
|
||||
break;
|
||||
@ -7869,7 +7869,7 @@ get_sublink_expr(SubLink *sublink, deparse_context *context)
|
||||
context->indentLevel);
|
||||
|
||||
if (need_paren)
|
||||
appendStringInfo(buf, "))");
|
||||
appendStringInfoString(buf, "))");
|
||||
else
|
||||
appendStringInfoChar(buf, ')');
|
||||
}
|
||||
@ -8140,7 +8140,7 @@ get_from_clause_item(Node *jtnode, Query *query, deparse_context *context)
|
||||
ListCell *lc;
|
||||
bool first = true;
|
||||
|
||||
appendStringInfo(buf, " USING (");
|
||||
appendStringInfoString(buf, " USING (");
|
||||
/* Use the assigned names, not what's in usingClause */
|
||||
foreach(lc, colinfo->usingNames)
|
||||
{
|
||||
@ -8149,14 +8149,14 @@ get_from_clause_item(Node *jtnode, Query *query, deparse_context *context)
|
||||
if (first)
|
||||
first = false;
|
||||
else
|
||||
appendStringInfo(buf, ", ");
|
||||
appendStringInfoString(buf, ", ");
|
||||
appendStringInfoString(buf, quote_identifier(colname));
|
||||
}
|
||||
appendStringInfoChar(buf, ')');
|
||||
}
|
||||
else if (j->quals)
|
||||
{
|
||||
appendStringInfo(buf, " ON ");
|
||||
appendStringInfoString(buf, " ON ");
|
||||
if (!PRETTY_PAREN(context))
|
||||
appendStringInfoChar(buf, '(');
|
||||
get_rule_expr(j->quals, context, false);
|
||||
@ -8206,7 +8206,7 @@ get_column_alias_list(deparse_columns *colinfo, deparse_context *context)
|
||||
first = false;
|
||||
}
|
||||
else
|
||||
appendStringInfo(buf, ", ");
|
||||
appendStringInfoString(buf, ", ");
|
||||
appendStringInfoString(buf, quote_identifier(colname));
|
||||
}
|
||||
if (!first)
|
||||
@ -8243,7 +8243,7 @@ get_from_clause_coldeflist(deparse_columns *colinfo,
|
||||
Assert(attname); /* shouldn't be any dropped columns here */
|
||||
|
||||
if (i > 0)
|
||||
appendStringInfo(buf, ", ");
|
||||
appendStringInfoString(buf, ", ");
|
||||
appendStringInfo(buf, "%s %s",
|
||||
quote_identifier(attname),
|
||||
format_type_with_typemod(atttypid, atttypmod));
|
||||
|
Reference in New Issue
Block a user