mirror of
https://github.com/postgres/postgres.git
synced 2025-11-06 07:49:08 +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:
@@ -1117,9 +1117,9 @@ fetch_table_list(WalReceiverConn *wrconn, List *publications)
|
||||
Assert(list_length(publications) > 0);
|
||||
|
||||
initStringInfo(&cmd);
|
||||
appendStringInfo(&cmd, "SELECT DISTINCT t.schemaname, t.tablename\n"
|
||||
" FROM pg_catalog.pg_publication_tables t\n"
|
||||
" WHERE t.pubname IN (");
|
||||
appendStringInfoString(&cmd, "SELECT DISTINCT t.schemaname, t.tablename\n"
|
||||
" FROM pg_catalog.pg_publication_tables t\n"
|
||||
" WHERE t.pubname IN (");
|
||||
first = true;
|
||||
foreach(lc, publications)
|
||||
{
|
||||
@@ -1130,9 +1130,9 @@ fetch_table_list(WalReceiverConn *wrconn, List *publications)
|
||||
else
|
||||
appendStringInfoString(&cmd, ", ");
|
||||
|
||||
appendStringInfo(&cmd, "%s", quote_literal_cstr(pubname));
|
||||
appendStringInfoString(&cmd, quote_literal_cstr(pubname));
|
||||
}
|
||||
appendStringInfoString(&cmd, ")");
|
||||
appendStringInfoChar(&cmd, ')');
|
||||
|
||||
res = walrcv_exec(wrconn, cmd.data, 2, tableRow);
|
||||
pfree(cmd.data);
|
||||
|
||||
@@ -83,7 +83,7 @@ static void outChar(StringInfo str, char c);
|
||||
|
||||
/* Write a character-string (possibly NULL) field */
|
||||
#define WRITE_STRING_FIELD(fldname) \
|
||||
(appendStringInfo(str, " :" CppAsString(fldname) " "), \
|
||||
(appendStringInfoString(str, " :" CppAsString(fldname) " "), \
|
||||
outToken(str, node->fldname))
|
||||
|
||||
/* Write a parse location field (actually same as INT case) */
|
||||
@@ -92,12 +92,12 @@ static void outChar(StringInfo str, char c);
|
||||
|
||||
/* Write a Node field */
|
||||
#define WRITE_NODE_FIELD(fldname) \
|
||||
(appendStringInfo(str, " :" CppAsString(fldname) " "), \
|
||||
(appendStringInfoString(str, " :" CppAsString(fldname) " "), \
|
||||
outNode(str, node->fldname))
|
||||
|
||||
/* Write a bitmapset field */
|
||||
#define WRITE_BITMAPSET_FIELD(fldname) \
|
||||
(appendStringInfo(str, " :" CppAsString(fldname) " "), \
|
||||
(appendStringInfoString(str, " :" CppAsString(fldname) " "), \
|
||||
outBitmapset(str, node->fldname))
|
||||
|
||||
|
||||
|
||||
@@ -355,7 +355,7 @@ libpqrcv_startstreaming(WalReceiverConn *conn,
|
||||
options->slotname);
|
||||
|
||||
if (options->logical)
|
||||
appendStringInfo(&cmd, " LOGICAL");
|
||||
appendStringInfoString(&cmd, " LOGICAL");
|
||||
|
||||
appendStringInfo(&cmd, " %X/%X",
|
||||
(uint32) (options->startpoint >> 32),
|
||||
@@ -774,21 +774,21 @@ libpqrcv_create_slot(WalReceiverConn *conn, const char *slotname,
|
||||
appendStringInfo(&cmd, "CREATE_REPLICATION_SLOT \"%s\"", slotname);
|
||||
|
||||
if (temporary)
|
||||
appendStringInfo(&cmd, " TEMPORARY");
|
||||
appendStringInfoString(&cmd, " TEMPORARY");
|
||||
|
||||
if (conn->logical)
|
||||
{
|
||||
appendStringInfo(&cmd, " LOGICAL pgoutput");
|
||||
appendStringInfoString(&cmd, " LOGICAL pgoutput");
|
||||
switch (snapshot_action)
|
||||
{
|
||||
case CRS_EXPORT_SNAPSHOT:
|
||||
appendStringInfo(&cmd, " EXPORT_SNAPSHOT");
|
||||
appendStringInfoString(&cmd, " EXPORT_SNAPSHOT");
|
||||
break;
|
||||
case CRS_NOEXPORT_SNAPSHOT:
|
||||
appendStringInfo(&cmd, " NOEXPORT_SNAPSHOT");
|
||||
appendStringInfoString(&cmd, " NOEXPORT_SNAPSHOT");
|
||||
break;
|
||||
case CRS_USE_SNAPSHOT:
|
||||
appendStringInfo(&cmd, " USE_SNAPSHOT");
|
||||
appendStringInfoString(&cmd, " USE_SNAPSHOT");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1656,11 +1656,11 @@ pg_get_partkeydef_worker(Oid relid, int prettyFlags,
|
||||
{
|
||||
case PARTITION_STRATEGY_LIST:
|
||||
if (!attrsOnly)
|
||||
appendStringInfo(&buf, "LIST");
|
||||
appendStringInfoString(&buf, "LIST");
|
||||
break;
|
||||
case PARTITION_STRATEGY_RANGE:
|
||||
if (!attrsOnly)
|
||||
appendStringInfo(&buf, "RANGE");
|
||||
appendStringInfoString(&buf, "RANGE");
|
||||
break;
|
||||
default:
|
||||
elog(ERROR, "unexpected partition strategy: %d",
|
||||
@@ -1668,7 +1668,7 @@ pg_get_partkeydef_worker(Oid relid, int prettyFlags,
|
||||
}
|
||||
|
||||
if (!attrsOnly)
|
||||
appendStringInfo(&buf, " (");
|
||||
appendStringInfoString(&buf, " (");
|
||||
sep = "";
|
||||
for (keyno = 0; keyno < form->partnatts; keyno++)
|
||||
{
|
||||
@@ -5635,10 +5635,10 @@ get_rule_sortgroupclause(Index ref, List *tlist, bool force_colno,
|
||||
||IsA(expr, WindowFunc));
|
||||
|
||||
if (need_paren)
|
||||
appendStringInfoString(context->buf, "(");
|
||||
appendStringInfoChar(context->buf, '(');
|
||||
get_rule_expr(expr, context, true);
|
||||
if (need_paren)
|
||||
appendStringInfoString(context->buf, ")");
|
||||
appendStringInfoChar(context->buf, ')');
|
||||
}
|
||||
|
||||
return expr;
|
||||
@@ -5665,7 +5665,7 @@ get_rule_groupingset(GroupingSet *gset, List *targetlist,
|
||||
case GROUPING_SET_SIMPLE:
|
||||
{
|
||||
if (!omit_parens || list_length(gset->content) != 1)
|
||||
appendStringInfoString(buf, "(");
|
||||
appendStringInfoChar(buf, '(');
|
||||
|
||||
foreach(l, gset->content)
|
||||
{
|
||||
@@ -5678,7 +5678,7 @@ get_rule_groupingset(GroupingSet *gset, List *targetlist,
|
||||
}
|
||||
|
||||
if (!omit_parens || list_length(gset->content) != 1)
|
||||
appendStringInfoString(buf, ")");
|
||||
appendStringInfoChar(buf, ')');
|
||||
}
|
||||
return;
|
||||
|
||||
@@ -5701,7 +5701,7 @@ get_rule_groupingset(GroupingSet *gset, List *targetlist,
|
||||
sep = ", ";
|
||||
}
|
||||
|
||||
appendStringInfoString(buf, ")");
|
||||
appendStringInfoChar(buf, ')');
|
||||
}
|
||||
|
||||
/*
|
||||
@@ -8713,7 +8713,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
||||
sep = ", ";
|
||||
}
|
||||
|
||||
appendStringInfoString(buf, ")");
|
||||
appendStringInfoChar(buf, ')');
|
||||
break;
|
||||
|
||||
case PARTITION_STRATEGY_RANGE:
|
||||
@@ -10941,7 +10941,7 @@ get_range_partbound_string(List *bound_datums)
|
||||
}
|
||||
sep = ", ";
|
||||
}
|
||||
appendStringInfoString(buf, ")");
|
||||
appendStringInfoChar(buf, ')');
|
||||
|
||||
return buf->data;
|
||||
}
|
||||
|
||||
@@ -3458,8 +3458,8 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod)
|
||||
case BPCHAROID:
|
||||
case VARCHAROID:
|
||||
case TEXTOID:
|
||||
appendStringInfo(&result,
|
||||
" <xsd:restriction base=\"xsd:string\">\n");
|
||||
appendStringInfoString(&result,
|
||||
" <xsd:restriction base=\"xsd:string\">\n");
|
||||
if (typmod != -1)
|
||||
appendStringInfo(&result,
|
||||
" <xsd:maxLength value=\"%d\"/>\n",
|
||||
|
||||
@@ -455,7 +455,7 @@ FreePageManagerDump(FreePageManager *fpm)
|
||||
recycle = relptr_access(base, fpm->btree_recycle);
|
||||
if (recycle != NULL)
|
||||
{
|
||||
appendStringInfo(&buf, "btree recycle:");
|
||||
appendStringInfoString(&buf, "btree recycle:");
|
||||
FreePageManagerDumpSpans(fpm, recycle, 1, &buf);
|
||||
}
|
||||
|
||||
@@ -468,7 +468,7 @@ FreePageManagerDump(FreePageManager *fpm)
|
||||
continue;
|
||||
if (!dumped_any_freelist)
|
||||
{
|
||||
appendStringInfo(&buf, "freelists:\n");
|
||||
appendStringInfoString(&buf, "freelists:\n");
|
||||
dumped_any_freelist = true;
|
||||
}
|
||||
appendStringInfo(&buf, " %zu:", f + 1);
|
||||
@@ -1275,7 +1275,7 @@ FreePageManagerDumpBtree(FreePageManager *fpm, FreePageBtree *btp,
|
||||
btp->u.leaf_key[index].first_page,
|
||||
btp->u.leaf_key[index].npages);
|
||||
}
|
||||
appendStringInfo(buf, "\n");
|
||||
appendStringInfoChar(buf, '\n');
|
||||
|
||||
if (btp->hdr.magic == FREE_PAGE_INTERNAL_MAGIC)
|
||||
{
|
||||
@@ -1308,7 +1308,7 @@ FreePageManagerDumpSpans(FreePageManager *fpm, FreePageSpanLeader *span,
|
||||
span = relptr_access(base, span->next);
|
||||
}
|
||||
|
||||
appendStringInfo(buf, "\n");
|
||||
appendStringInfoChar(buf, '\n');
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
Reference in New Issue
Block a user