Commit cacbdd78 authored by Robert Haas's avatar Robert Haas

Use appendStringInfoString instead of appendStringInfo where possible.

This shaves a few cycles, and generally seems like good programming
practice.

David Rowley
parent 343bb134
......@@ -335,18 +335,18 @@ cube_out(PG_FUNCTION_ARGS)
for (i = 0; i < dim; i++)
{
if (i > 0)
appendStringInfo(&buf, ", ");
appendStringInfoString(&buf, ", ");
appendStringInfo(&buf, "%.*g", ndig, LL_COORD(cube, i));
}
appendStringInfoChar(&buf, ')');
if (!cube_is_point_internal(cube))
{
appendStringInfo(&buf, ",(");
appendStringInfoString(&buf, ",(");
for (i = 0; i < dim; i++)
{
if (i > 0)
appendStringInfo(&buf, ", ");
appendStringInfoString(&buf, ", ");
appendStringInfo(&buf, "%.*g", ndig, UR_COORD(cube, i));
}
appendStringInfoChar(&buf, ')');
......
......@@ -2169,14 +2169,14 @@ get_sql_insert(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals
continue;
if (needComma)
appendStringInfo(&buf, ",");
appendStringInfoChar(&buf, ',');
appendStringInfoString(&buf,
quote_ident_cstr(NameStr(tupdesc->attrs[i]->attname)));
needComma = true;
}
appendStringInfo(&buf, ") VALUES(");
appendStringInfoString(&buf, ") VALUES(");
/*
* Note: i is physical column number (counting from 0).
......@@ -2188,7 +2188,7 @@ get_sql_insert(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals
continue;
if (needComma)
appendStringInfo(&buf, ",");
appendStringInfoChar(&buf, ',');
key = get_attnum_pk_pos(pkattnums, pknumatts, i);
......@@ -2203,10 +2203,10 @@ get_sql_insert(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals
pfree(val);
}
else
appendStringInfo(&buf, "NULL");
appendStringInfoString(&buf, "NULL");
needComma = true;
}
appendStringInfo(&buf, ")");
appendStringInfoChar(&buf, ')');
return (buf.data);
}
......@@ -2232,7 +2232,7 @@ get_sql_delete(Relation rel, int *pkattnums, int pknumatts, char **tgt_pkattvals
int pkattnum = pkattnums[i];
if (i > 0)
appendStringInfo(&buf, " AND ");
appendStringInfoString(&buf, " AND ");
appendStringInfoString(&buf,
quote_ident_cstr(NameStr(tupdesc->attrs[pkattnum]->attname)));
......@@ -2241,7 +2241,7 @@ get_sql_delete(Relation rel, int *pkattnums, int pknumatts, char **tgt_pkattvals
appendStringInfo(&buf, " = %s",
quote_literal_cstr(tgt_pkattvals[i]));
else
appendStringInfo(&buf, " IS NULL");
appendStringInfoString(&buf, " IS NULL");
}
return (buf.data);
......@@ -2286,7 +2286,7 @@ get_sql_update(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals
continue;
if (needComma)
appendStringInfo(&buf, ", ");
appendStringInfoString(&buf, ", ");
appendStringInfo(&buf, "%s = ",
quote_ident_cstr(NameStr(tupdesc->attrs[i]->attname)));
......@@ -2308,16 +2308,16 @@ get_sql_update(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals
needComma = true;
}
appendStringInfo(&buf, " WHERE ");
appendStringInfoString(&buf, " WHERE ");
for (i = 0; i < pknumatts; i++)
{
int pkattnum = pkattnums[i];
if (i > 0)
appendStringInfo(&buf, " AND ");
appendStringInfoString(&buf, " AND ");
appendStringInfo(&buf, "%s",
appendStringInfoString(&buf,
quote_ident_cstr(NameStr(tupdesc->attrs[pkattnum]->attname)));
val = tgt_pkattvals[i];
......@@ -2325,7 +2325,7 @@ get_sql_update(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals
if (val != NULL)
appendStringInfo(&buf, " = %s", quote_literal_cstr(val));
else
appendStringInfo(&buf, " IS NULL");
appendStringInfoString(&buf, " IS NULL");
}
return (buf.data);
......@@ -2419,7 +2419,7 @@ get_tuple_of_interest(Relation rel, int *pkattnums, int pknumatts, char **src_pk
int pkattnum = pkattnums[i];
if (i > 0)
appendStringInfo(&buf, " AND ");
appendStringInfoString(&buf, " AND ");
appendStringInfoString(&buf,
quote_ident_cstr(NameStr(tupdesc->attrs[pkattnum]->attname)));
......@@ -2428,7 +2428,7 @@ get_tuple_of_interest(Relation rel, int *pkattnums, int pknumatts, char **src_pk
appendStringInfo(&buf, " = %s",
quote_literal_cstr(src_pkattvals[i]));
else
appendStringInfo(&buf, " IS NULL");
appendStringInfoString(&buf, " IS NULL");
}
/*
......
......@@ -1972,7 +1972,7 @@ printSourceNFA(regex_t *regex, TrgmColorInfo *colors, int ncolors)
initStringInfo(&buf);
appendStringInfo(&buf, "\ndigraph sourceNFA {\n");
appendStringInfoString(&buf, "\ndigraph sourceNFA {\n");
for (state = 0; state < nstates; state++)
{
......@@ -1982,8 +1982,8 @@ printSourceNFA(regex_t *regex, TrgmColorInfo *colors, int ncolors)
appendStringInfo(&buf, "s%d", state);
if (pg_reg_getfinalstate(regex) == state)
appendStringInfo(&buf, " [shape = doublecircle]");
appendStringInfo(&buf, ";\n");
appendStringInfoString(&buf, " [shape = doublecircle]");
appendStringInfoString(&buf, ";\n");
arcsCount = pg_reg_getnumoutarcs(regex, state);
arcs = (regex_arc_t *) palloc(sizeof(regex_arc_t) * arcsCount);
......@@ -1998,13 +1998,13 @@ printSourceNFA(regex_t *regex, TrgmColorInfo *colors, int ncolors)
pfree(arcs);
}
appendStringInfo(&buf, " node [shape = point ]; initial;\n");
appendStringInfoString(&buf, " node [shape = point ]; initial;\n");
appendStringInfo(&buf, " initial -> s%d;\n",
pg_reg_getinitialstate(regex));
/* Print colors */
appendStringInfo(&buf, " { rank = sink;\n");
appendStringInfo(&buf, " Colors [shape = none, margin=0, label=<\n");
appendStringInfoString(&buf, " { rank = sink;\n");
appendStringInfoString(&buf, " Colors [shape = none, margin=0, label=<\n");
for (i = 0; i < ncolors; i++)
{
......@@ -2020,17 +2020,17 @@ printSourceNFA(regex_t *regex, TrgmColorInfo *colors, int ncolors)
memcpy(s, color->wordChars[j].bytes, MAX_MULTIBYTE_CHAR_LEN);
s[MAX_MULTIBYTE_CHAR_LEN] = '\0';
appendStringInfo(&buf, "%s", s);
appendStringInfoString(&buf, s);
}
}
else
appendStringInfo(&buf, "not expandable");
appendStringInfo(&buf, "\n");
appendStringInfoString(&buf, "not expandable");
appendStringInfoChar(&buf, '\n');
}
appendStringInfo(&buf, " >];\n");
appendStringInfo(&buf, " }\n");
appendStringInfo(&buf, "}\n");
appendStringInfoString(&buf, " >];\n");
appendStringInfoString(&buf, " }\n");
appendStringInfoString(&buf, "}\n");
{
/* dot -Tpng -o /tmp/source.png < /tmp/source.dot */
......@@ -2056,7 +2056,7 @@ printTrgmNFA(TrgmNFA *trgmNFA)
initStringInfo(&buf);
appendStringInfo(&buf, "\ndigraph transformedNFA {\n");
appendStringInfoString(&buf, "\ndigraph transformedNFA {\n");
hash_seq_init(&scan_status, trgmNFA->states);
while ((state = (TrgmState *) hash_seq_search(&scan_status)) != NULL)
......@@ -2065,11 +2065,11 @@ printTrgmNFA(TrgmNFA *trgmNFA)
appendStringInfo(&buf, "s%p", (void *) state);
if (state->fin)
appendStringInfo(&buf, " [shape = doublecircle]");
appendStringInfoString(&buf, " [shape = doublecircle]");
if (state->init)
initstate = state;
appendStringInfo(&buf, " [label = \"%d\"]", state->stateKey.nstate);
appendStringInfo(&buf, ";\n");
appendStringInfoString(&buf, ";\n");
foreach(cell, state->arcs)
{
......@@ -2078,21 +2078,21 @@ printTrgmNFA(TrgmNFA *trgmNFA)
appendStringInfo(&buf, " s%p -> s%p [label = \"",
(void *) state, (void *) arc->target);
printTrgmColor(&buf, arc->ctrgm.colors[0]);
appendStringInfo(&buf, " ");
appendStringInfoChar(&buf, ' ');
printTrgmColor(&buf, arc->ctrgm.colors[1]);
appendStringInfo(&buf, " ");
appendStringInfoChar(&buf, ' ');
printTrgmColor(&buf, arc->ctrgm.colors[2]);
appendStringInfo(&buf, "\"];\n");
appendStringInfoString(&buf, "\"];\n");
}
}
if (initstate)
{
appendStringInfo(&buf, " node [shape = point ]; initial;\n");
appendStringInfoString(&buf, " node [shape = point ]; initial;\n");
appendStringInfo(&buf, " initial -> s%p;\n", (void *) initstate);
}
appendStringInfo(&buf, "}\n");
appendStringInfoString(&buf, "}\n");
{
/* dot -Tpng -o /tmp/transformed.png < /tmp/transformed.dot */
......@@ -2112,9 +2112,9 @@ static void
printTrgmColor(StringInfo buf, TrgmColor co)
{
if (co == COLOR_UNKNOWN)
appendStringInfo(buf, "u");
appendStringInfoChar(buf, 'u');
else if (co == COLOR_BLANK)
appendStringInfo(buf, "b");
appendStringInfoChar(buf, 'b');
else
appendStringInfo(buf, "%d", (int) co);
}
......@@ -2131,7 +2131,7 @@ printTrgmPackedGraph(TrgmPackedGraph *packedGraph, TRGM *trigrams)
initStringInfo(&buf);
appendStringInfo(&buf, "\ndigraph packedGraph {\n");
appendStringInfoString(&buf, "\ndigraph packedGraph {\n");
for (i = 0; i < packedGraph->statesCount; i++)
{
......@@ -2140,7 +2140,7 @@ printTrgmPackedGraph(TrgmPackedGraph *packedGraph, TRGM *trigrams)
appendStringInfo(&buf, " s%d", i);
if (i == 1)
appendStringInfo(&buf, " [shape = doublecircle]");
appendStringInfoString(&buf, " [shape = doublecircle]");
appendStringInfo(&buf, " [label = <s%d>];\n", i);
......@@ -2153,12 +2153,12 @@ printTrgmPackedGraph(TrgmPackedGraph *packedGraph, TRGM *trigrams)
}
}
appendStringInfo(&buf, " node [shape = point ]; initial;\n");
appendStringInfoString(&buf, " node [shape = point ]; initial;\n");
appendStringInfo(&buf, " initial -> s%d;\n", 0);
/* Print trigrams */
appendStringInfo(&buf, " { rank = sink;\n");
appendStringInfo(&buf, " Trigrams [shape = none, margin=0, label=<\n");
appendStringInfoString(&buf, " { rank = sink;\n");
appendStringInfoString(&buf, " Trigrams [shape = none, margin=0, label=<\n");
p = GETARR(trigrams);
for (i = 0; i < packedGraph->colorTrigramsCount; i++)
......@@ -2171,7 +2171,7 @@ printTrgmPackedGraph(TrgmPackedGraph *packedGraph, TRGM *trigrams)
for (j = 0; j < count; j++)
{
if (j > 0)
appendStringInfo(&buf, ", ");
appendStringInfoString(&buf, ", ");
/*
* XXX This representation is nice only for all-ASCII trigrams.
......@@ -2181,9 +2181,9 @@ printTrgmPackedGraph(TrgmPackedGraph *packedGraph, TRGM *trigrams)
}
}
appendStringInfo(&buf, " >];\n");
appendStringInfo(&buf, " }\n");
appendStringInfo(&buf, "}\n");
appendStringInfoString(&buf, " >];\n");
appendStringInfoString(&buf, " }\n");
appendStringInfoString(&buf, "}\n");
{
/* dot -Tpng -o /tmp/packed.png < /tmp/packed.dot */
......
......@@ -841,7 +841,7 @@ deparseInsertSql(StringInfo buf, PlannerInfo *root,
if (targetAttrs)
{
appendStringInfoString(buf, "(");
appendStringInfoChar(buf, '(');
first = true;
foreach(lc, targetAttrs)
......@@ -869,7 +869,7 @@ deparseInsertSql(StringInfo buf, PlannerInfo *root,
pindex++;
}
appendStringInfoString(buf, ")");
appendStringInfoChar(buf, ')');
}
else
appendStringInfoString(buf, " DEFAULT VALUES");
......@@ -989,7 +989,7 @@ deparseAnalyzeSizeSql(StringInfo buf, Relation rel)
initStringInfo(&relname);
deparseRelation(&relname, rel);
appendStringInfo(buf, "SELECT pg_catalog.pg_relation_size(");
appendStringInfoString(buf, "SELECT pg_catalog.pg_relation_size(");
deparseStringLiteral(buf, relname.data);
appendStringInfo(buf, "::pg_catalog.regclass) / %d", BLCKSZ);
}
......@@ -1302,7 +1302,7 @@ deparseConst(Const *node, deparse_expr_cxt *context)
if (node->constisnull)
{
appendStringInfo(buf, "NULL");
appendStringInfoString(buf, "NULL");
appendStringInfo(buf, "::%s",
format_type_with_typemod(node->consttype,
node->consttypmod));
......@@ -1650,7 +1650,7 @@ deparseOperatorName(StringInfo buf, Form_pg_operator opform)
else
{
/* Just print operator name. */
appendStringInfo(buf, "%s", opname);
appendStringInfoString(buf, opname);
}
}
......
......@@ -787,7 +787,7 @@ postgresGetForeignPlan(PlannerInfo *root,
root->parse->commandType == CMD_DELETE))
{
/* Relation is UPDATE/DELETE target, so use FOR UPDATE */
appendStringInfo(&sql, " FOR UPDATE");
appendStringInfoString(&sql, " FOR UPDATE");
}
else
{
......@@ -808,11 +808,11 @@ postgresGetForeignPlan(PlannerInfo *root,
{
case LCS_FORKEYSHARE:
case LCS_FORSHARE:
appendStringInfo(&sql, " FOR SHARE");
appendStringInfoString(&sql, " FOR SHARE");
break;
case LCS_FORNOKEYUPDATE:
case LCS_FORUPDATE:
appendStringInfo(&sql, " FOR UPDATE");
appendStringInfoString(&sql, " FOR UPDATE");
break;
}
}
......
......@@ -1340,7 +1340,7 @@ build_tuplestore_recursively(char *key_fld,
for (i = 0; i < proc; i++)
{
/* initialize branch for this pass */
appendStringInfo(&branchstr, "%s", branch);
appendStringInfoString(&branchstr, branch);
appendStringInfo(&chk_branchstr, "%s%s%s", branch_delim, branch, branch_delim);
/* get the next sql result tuple */
......
......@@ -37,5 +37,5 @@ clog_desc(StringInfo buf, uint8 xl_info, char *rec)
appendStringInfo(buf, "truncate before: %d", pageno);
}
else
appendStringInfo(buf, "UNKNOWN");
appendStringInfoString(buf, "UNKNOWN");
}
......@@ -39,5 +39,5 @@ dbase_desc(StringInfo buf, uint8 xl_info, char *rec)
xlrec->db_id, xlrec->tablespace_id);
}
else
appendStringInfo(buf, "UNKNOWN");
appendStringInfoString(buf, "UNKNOWN");
}
......@@ -33,15 +33,15 @@ gin_desc(StringInfo buf, uint8 xl_info, char *rec)
switch (info)
{
case XLOG_GIN_CREATE_INDEX:
appendStringInfo(buf, "Create index, ");
appendStringInfoString(buf, "Create index, ");
desc_node(buf, *(RelFileNode *) rec, GIN_ROOT_BLKNO);
break;
case XLOG_GIN_CREATE_PTREE:
appendStringInfo(buf, "Create posting tree, ");
appendStringInfoString(buf, "Create posting tree, ");
desc_node(buf, ((ginxlogCreatePostingTree *) rec)->node, ((ginxlogCreatePostingTree *) rec)->blkno);
break;
case XLOG_GIN_INSERT:
appendStringInfo(buf, "Insert item, ");
appendStringInfoString(buf, "Insert item, ");
desc_node(buf, ((ginxlogInsert *) rec)->node, ((ginxlogInsert *) rec)->blkno);
appendStringInfo(buf, " offset: %u nitem: %u isdata: %c isleaf %c isdelete %c updateBlkno:%u",
((ginxlogInsert *) rec)->offset,
......@@ -52,24 +52,24 @@ gin_desc(StringInfo buf, uint8 xl_info, char *rec)
((ginxlogInsert *) rec)->updateBlkno);
break;
case XLOG_GIN_SPLIT:
appendStringInfo(buf, "Page split, ");
appendStringInfoString(buf, "Page split, ");
desc_node(buf, ((ginxlogSplit *) rec)->node, ((ginxlogSplit *) rec)->lblkno);
appendStringInfo(buf, " isrootsplit: %c", (((ginxlogSplit *) rec)->isRootSplit) ? 'T' : 'F');
break;
case XLOG_GIN_VACUUM_PAGE:
appendStringInfo(buf, "Vacuum page, ");
appendStringInfoString(buf, "Vacuum page, ");
desc_node(buf, ((ginxlogVacuumPage *) rec)->node, ((ginxlogVacuumPage *) rec)->blkno);
break;
case XLOG_GIN_DELETE_PAGE:
appendStringInfo(buf, "Delete page, ");
appendStringInfoString(buf, "Delete page, ");
desc_node(buf, ((ginxlogDeletePage *) rec)->node, ((ginxlogDeletePage *) rec)->blkno);
break;
case XLOG_GIN_UPDATE_META_PAGE:
appendStringInfo(buf, "Update metapage, ");
appendStringInfoString(buf, "Update metapage, ");
desc_node(buf, ((ginxlogUpdateMeta *) rec)->node, GIN_METAPAGE_BLKNO);
break;
case XLOG_GIN_INSERT_LISTPAGE:
appendStringInfo(buf, "Insert new list page, ");
appendStringInfoString(buf, "Insert new list page, ");
desc_node(buf, ((ginxlogInsertListPage *) rec)->node, ((ginxlogInsertListPage *) rec)->blkno);
break;
case XLOG_GIN_DELETE_LISTPAGE:
......
......@@ -35,7 +35,7 @@ out_gistxlogPageUpdate(StringInfo buf, gistxlogPageUpdate *xlrec)
static void
out_gistxlogPageSplit(StringInfo buf, gistxlogPageSplit *xlrec)
{
appendStringInfo(buf, "page_split: ");
appendStringInfoString(buf, "page_split: ");
out_target(buf, xlrec->node);
appendStringInfo(buf, "; block number %u splits to %d pages",
xlrec->origblkno, xlrec->npage);
......@@ -49,7 +49,7 @@ gist_desc(StringInfo buf, uint8 xl_info, char *rec)
switch (info)
{
case XLOG_GIST_PAGE_UPDATE:
appendStringInfo(buf, "page_update: ");
appendStringInfoString(buf, "page_update: ");
out_gistxlogPageUpdate(buf, (gistxlogPageUpdate *) rec);
break;
case XLOG_GIST_PAGE_SPLIT:
......
......@@ -29,15 +29,15 @@ static void
out_infobits(StringInfo buf, uint8 infobits)
{
if (infobits & XLHL_XMAX_IS_MULTI)
appendStringInfo(buf, "IS_MULTI ");
appendStringInfoString(buf, "IS_MULTI ");
if (infobits & XLHL_XMAX_LOCK_ONLY)
appendStringInfo(buf, "LOCK_ONLY ");
appendStringInfoString(buf, "LOCK_ONLY ");
if (infobits & XLHL_XMAX_EXCL_LOCK)
appendStringInfo(buf, "EXCL_LOCK ");
appendStringInfoString(buf, "EXCL_LOCK ");
if (infobits & XLHL_XMAX_KEYSHR_LOCK)
appendStringInfo(buf, "KEYSHR_LOCK ");
appendStringInfoString(buf, "KEYSHR_LOCK ");
if (infobits & XLHL_KEYS_UPDATED)
appendStringInfo(buf, "KEYS_UPDATED ");
appendStringInfoString(buf, "KEYS_UPDATED ");
}
void
......@@ -51,16 +51,16 @@ heap_desc(StringInfo buf, uint8 xl_info, char *rec)
xl_heap_insert *xlrec = (xl_heap_insert *) rec;
if (xl_info & XLOG_HEAP_INIT_PAGE)
appendStringInfo(buf, "insert(init): ");
appendStringInfoString(buf, "insert(init): ");
else
appendStringInfo(buf, "insert: ");
appendStringInfoString(buf, "insert: ");
out_target(buf, &(xlrec->target));
}
else if (info == XLOG_HEAP_DELETE)
{
xl_heap_delete *xlrec = (xl_heap_delete *) rec;
appendStringInfo(buf, "delete: ");
appendStringInfoString(buf, "delete: ");
out_target(buf, &(xlrec->target));
appendStringInfoChar(buf, ' ');
out_infobits(buf, xlrec->infobits_set);
......@@ -70,9 +70,9 @@ heap_desc(StringInfo buf, uint8 xl_info, char *rec)
xl_heap_update *xlrec = (xl_heap_update *) rec;
if (xl_info & XLOG_HEAP_INIT_PAGE)
appendStringInfo(buf, "update(init): ");
appendStringInfoString(buf, "update(init): ");
else
appendStringInfo(buf, "update: ");
appendStringInfoString(buf, "update: ");
out_target(buf, &(xlrec->target));
appendStringInfo(buf, " xmax %u ", xlrec->old_xmax);
out_infobits(buf, xlrec->old_infobits_set);
......@@ -86,9 +86,9 @@ heap_desc(StringInfo buf, uint8 xl_info, char *rec)
xl_heap_update *xlrec = (xl_heap_update *) rec;
if (xl_info & XLOG_HEAP_INIT_PAGE) /* can this case happen? */
appendStringInfo(buf, "hot_update(init): ");
appendStringInfoString(buf, "hot_update(init): ");
else
appendStringInfo(buf, "hot_update: ");
appendStringInfoString(buf, "hot_update: ");
out_target(buf, &(xlrec->target));
appendStringInfo(buf, " xmax %u ", xlrec->old_xmax);
out_infobits(buf, xlrec->old_infobits_set);
......@@ -119,11 +119,11 @@ heap_desc(StringInfo buf, uint8 xl_info, char *rec)
{
xl_heap_inplace *xlrec = (xl_heap_inplace *) rec;
appendStringInfo(buf, "inplace: ");
appendStringInfoString(buf, "inplace: ");
out_target(buf, &(xlrec->target));
}
else
appendStringInfo(buf, "UNKNOWN");
appendStringInfoString(buf, "UNKNOWN");
}
void
heap2_desc(StringInfo buf, uint8 xl_info, char *rec)
......@@ -169,9 +169,9 @@ heap2_desc(StringInfo buf, uint8 xl_info, char *rec)
xl_heap_multi_insert *xlrec = (xl_heap_multi_insert *) rec;
if (xl_info & XLOG_HEAP_INIT_PAGE)
appendStringInfo(buf, "multi-insert (init): ");
appendStringInfoString(buf, "multi-insert (init): ");
else
appendStringInfo(buf, "multi-insert: ");
appendStringInfoString(buf, "multi-insert: ");
appendStringInfo(buf, "rel %u/%u/%u; blk %u; %d tuples",
xlrec->node.spcNode, xlrec->node.dbNode, xlrec->node.relNode,
xlrec->blkno, xlrec->ntuples);
......@@ -185,5 +185,5 @@ heap2_desc(StringInfo buf, uint8 xl_info, char *rec)
out_target(buf, &(xlrec->target));
}
else
appendStringInfo(buf, "UNKNOWN");
appendStringInfoString(buf, "UNKNOWN");
}
......@@ -76,5 +76,5 @@ multixact_desc(StringInfo buf, uint8 xl_info, char *rec)
out_member(buf, &xlrec->members[i]);
}
else
appendStringInfo(buf, "UNKNOWN");
appendStringInfoString(buf, "UNKNOWN");
}
......@@ -36,7 +36,7 @@ btree_desc(StringInfo buf, uint8 xl_info, char *rec)
{
xl_btree_insert *xlrec = (xl_btree_insert *) rec;
appendStringInfo(buf, "insert: ");
appendStringInfoString(buf, "insert: ");
out_target(buf, &(xlrec->target));
break;
}
......@@ -44,7 +44,7 @@ btree_desc(StringInfo buf, uint8 xl_info, char *rec)
{
xl_btree_insert *xlrec = (xl_btree_insert *) rec;
appendStringInfo(buf, "insert_upper: ");
appendStringInfoString(buf, "insert_upper: ");
out_target(buf, &(xlrec->target));
break;
}
......@@ -52,7 +52,7 @@ btree_desc(StringInfo buf, uint8 xl_info, char *rec)
{
xl_btree_insert *xlrec = (xl_btree_insert *) rec;
appendStringInfo(buf, "insert_meta: ");
appendStringInfoString(buf, "insert_meta: ");
out_target(buf, &(xlrec->target));
break;
}
......@@ -130,7 +130,7 @@ btree_desc(StringInfo buf, uint8 xl_info, char *rec)
{
xl_btree_delete_page *xlrec = (xl_btree_delete_page *) rec;
appendStringInfo(buf, "delete_page: ");
appendStringInfoString(buf, "delete_page: ");
out_target(buf, &(xlrec->target));
appendStringInfo(buf, "; dead %u; left %u; right %u",
xlrec->deadblk, xlrec->leftblk, xlrec->rightblk);
......@@ -156,7 +156,7 @@ btree_desc(StringInfo buf, uint8 xl_info, char *rec)
break;
}
default:
appendStringInfo(buf, "UNKNOWN");
appendStringInfoString(buf, "UNKNOWN");
break;
}
}
......@@ -29,5 +29,5 @@ relmap_desc(StringInfo buf, uint8 xl_info, char *rec)
xlrec->dbid, xlrec->tsid, xlrec->nbytes);
}
else
appendStringInfo(buf, "UNKNOWN");
appendStringInfoString(buf, "UNKNOWN");
}
......@@ -24,10 +24,10 @@ seq_desc(StringInfo buf, uint8 xl_info, char *rec)
xl_seq_rec *xlrec = (xl_seq_rec *) rec;
if (info == XLOG_SEQ_LOG)
appendStringInfo(buf, "log: ");
appendStringInfoString(buf, "log: ");
else
{
appendStringInfo(buf, "UNKNOWN");
appendStringInfoString(buf, "UNKNOWN");
return;
}
......
......@@ -42,5 +42,5 @@ smgr_desc(StringInfo buf, uint8 xl_info, char *rec)
pfree(path);
}
else
appendStringInfo(buf, "UNKNOWN");
appendStringInfoString(buf, "UNKNOWN");
}
......@@ -64,7 +64,7 @@ spg_desc(StringInfo buf, uint8 xl_info, char *rec)
break;
case XLOG_SPGIST_PICKSPLIT:
out_target(buf, ((spgxlogPickSplit *) rec)->node);
appendStringInfo(buf, "split leaf page");
appendStringInfoString(buf, "split leaf page");
break;
case XLOG_SPGIST_VACUUM_LEAF:
out_target(buf, ((spgxlogVacuumLeaf *) rec)->node);
......
......@@ -33,7 +33,7 @@ standby_desc_running_xacts(StringInfo buf, xl_running_xacts *xlrec)
}
if (xlrec->subxid_overflow)
appendStringInfo(buf, "; subxid ovf");
appendStringInfoString(buf, "; subxid ovf");
}
void
......@@ -46,7 +46,7 @@ standby_desc(StringInfo buf, uint8 xl_info, char *rec)
xl_standby_locks *xlrec = (xl_standby_locks *) rec;
int i;
appendStringInfo(buf, "AccessExclusive locks:");
appendStringInfoString(buf, "AccessExclusive locks:");
for (i = 0; i < xlrec->nlocks; i++)
appendStringInfo(buf, " xid %u db %u rel %u",
......@@ -57,9 +57,9 @@ standby_desc(StringInfo buf, uint8 xl_info, char *rec)
{
xl_running_xacts *xlrec = (xl_running_xacts *) rec;
appendStringInfo(buf, "running xacts:");
appendStringInfoString(buf, "running xacts:");
standby_desc_running_xacts(buf, xlrec);
}
else
appendStringInfo(buf, "UNKNOWN");
appendStringInfoString(buf, "UNKNOWN");
}
......@@ -36,5 +36,5 @@ tblspc_desc(StringInfo buf, uint8 xl_info, char *rec)
appendStringInfo(buf, "drop tablespace: %u", xlrec->ts_id);
}
else
appendStringInfo(buf, "UNKNOWN");
appendStringInfoString(buf, "UNKNOWN");
}
......@@ -33,7 +33,7 @@ xact_desc_commit(StringInfo buf, xl_xact_commit *xlrec)
if (xlrec->nrels > 0)
{
appendStringInfo(buf, "; rels:");
appendStringInfoString(buf, "; rels:");
for (i = 0; i < xlrec->nrels; i++)
{
char *path = relpathperm(xlrec->xnodes[i], MAIN_FORKNUM);
......@@ -44,7 +44,7 @@ xact_desc_commit(StringInfo buf, xl_xact_commit *xlrec)
}
if (xlrec->nsubxacts > 0)
{
appendStringInfo(buf, "; subxacts:");
appendStringInfoString(buf, "; subxacts:");
for (i = 0; i < xlrec->nsubxacts; i++)
appendStringInfo(buf, " %u", subxacts[i]);
}
......@@ -58,7 +58,7 @@ xact_desc_commit(StringInfo buf, xl_xact_commit *xlrec)
appendStringInfo(buf, "; relcache init file inval dbid %u tsid %u",
xlrec->dbId, xlrec->tsId);
appendStringInfo(buf, "; inval msgs:");
appendStringInfoString(buf, "; inval msgs:");
for (i = 0; i < xlrec->nmsgs; i++)
{
SharedInvalidationMessage *msg = &msgs[i];
......@@ -71,10 +71,10 @@ xact_desc_commit(StringInfo buf, xl_xact_commit *xlrec)
appendStringInfo(buf, " relcache %u", msg->rc.relId);
/* not expected, but print something anyway */
else if (msg->id == SHAREDINVALSMGR_ID)
appendStringInfo(buf, " smgr");
appendStringInfoString(buf, " smgr");
/* not expected, but print something anyway */
else if (msg->id == SHAREDINVALRELMAP_ID)
appendStringInfo(buf, " relmap");
appendStringInfoString(buf, " relmap");
else if (msg->id == SHAREDINVALSNAPSHOT_ID)
appendStringInfo(buf, " snapshot %u", msg->sn.relId);
else
......@@ -92,7 +92,7 @@ xact_desc_commit_compact(StringInfo buf, xl_xact_commit_compact *xlrec)
if (xlrec->nsubxacts > 0)
{
appendStringInfo(buf, "; subxacts:");
appendStringInfoString(buf, "; subxacts:");
for (i = 0; i < xlrec->nsubxacts; i++)
appendStringInfo(buf, " %u", xlrec->subxacts[i]);
}
......@@ -106,7 +106,7 @@ xact_desc_abort(StringInfo buf, xl_xact_abort *xlrec)
appendStringInfoString(buf, timestamptz_to_str(xlrec->xact_time));
if (xlrec->nrels > 0)
{
appendStringInfo(buf, "; rels:");
appendStringInfoString(buf, "; rels:");
for (i = 0; i < xlrec->nrels; i++)
{
char *path = relpathperm(xlrec->xnodes[i], MAIN_FORKNUM);
......@@ -120,7 +120,7 @@ xact_desc_abort(StringInfo buf, xl_xact_abort *xlrec)
TransactionId *xacts = (TransactionId *)
&xlrec->xnodes[xlrec->nrels];
appendStringInfo(buf, "; subxacts:");
appendStringInfoString(buf, "; subxacts:");
for (i = 0; i < xlrec->nsubxacts; i++)
appendStringInfo(buf, " %u", xacts[i]);
}
......@@ -131,7 +131,7 @@ xact_desc_assignment(StringInfo buf, xl_xact_assignment *xlrec)
{
int i;
appendStringInfo(buf, "subxacts:");
appendStringInfoString(buf, "subxacts:");
for (i = 0; i < xlrec->nsubxacts; i++)
appendStringInfo(buf, " %u", xlrec->xsub[i]);
......@@ -146,26 +146,26 @@ xact_desc(StringInfo buf, uint8 xl_info, char *rec)
{
xl_xact_commit_compact *xlrec = (xl_xact_commit_compact *) rec;
appendStringInfo(buf, "commit: ");
appendStringInfoString(buf, "commit: ");
xact_desc_commit_compact(buf, xlrec);
}
else if (info == XLOG_XACT_COMMIT)
{
xl_xact_commit *xlrec = (xl_xact_commit *) rec;
appendStringInfo(buf, "commit: ");
appendStringInfoString(buf, "commit: ");
xact_desc_commit(buf, xlrec);
}
else if (info == XLOG_XACT_ABORT)
{
xl_xact_abort *xlrec = (xl_xact_abort *) rec;
appendStringInfo(buf, "abort: ");
appendStringInfoString(buf, "abort: ");
xact_desc_abort(buf, xlrec);
}
else if (info == XLOG_XACT_PREPARE)
{
appendStringInfo(buf, "prepare");
appendStringInfoString(buf, "prepare");
}
else if (info == XLOG_XACT_COMMIT_PREPARED)
{
......@@ -194,5 +194,5 @@ xact_desc(StringInfo buf, uint8 xl_info, char *rec)
xact_desc_assignment(buf, xlrec);
}
else
appendStringInfo(buf, "UNKNOWN");
appendStringInfoString(buf, "UNKNOWN");
}
......@@ -62,7 +62,7 @@ xlog_desc(StringInfo buf, uint8 xl_info, char *rec)
}
else if (info == XLOG_NOOP)
{
appendStringInfo(buf, "xlog no-op");
appendStringInfoString(buf, "xlog no-op");
}
else if (info == XLOG_NEXTOID)
{
......@@ -73,7 +73,7 @@ xlog_desc(StringInfo buf, uint8 xl_info, char *rec)
}
else if (info == XLOG_SWITCH)
{
appendStringInfo(buf, "xlog switch");
appendStringInfoString(buf, "xlog switch");
}
else if (info == XLOG_RESTORE_POINT)
{
......@@ -141,5 +141,5 @@ xlog_desc(StringInfo buf, uint8 xl_info, char *rec)
timestamptz_to_str(xlrec.end_time));
}
else
appendStringInfo(buf, "UNKNOWN");
appendStringInfoString(buf, "UNKNOWN");
}
......@@ -1248,7 +1248,7 @@ begin:;
xlog_outrec(&buf, rechdr);
if (rdata->data != NULL)
{
appendStringInfo(&buf, " - ");
appendStringInfoString(&buf, " - ");
RmgrTable[rechdr->xl_rmid].rm_desc(&buf, rechdr->xl_info, rdata->data);
}
elog(LOG, "%s", buf.data);
......@@ -6677,7 +6677,7 @@ StartupXLOG(void)
(uint32) (ReadRecPtr >> 32), (uint32) ReadRecPtr,
(uint32) (EndRecPtr >> 32), (uint32) EndRecPtr);
xlog_outrec(&buf, record);
appendStringInfo(&buf, " - ");
appendStringInfoString(&buf, " - ");
RmgrTable[record->xl_rmid].rm_desc(&buf,
record->xl_info,
XLogRecGetData(record));
......
This diff is collapsed.
......@@ -1087,7 +1087,7 @@ ExplainNode(PlanState *planstate, List *ancestors,
if (((Join *) plan)->jointype != JOIN_INNER)
appendStringInfo(es->str, " %s Join", jointype);
else if (!IsA(plan, NestLoop))
appendStringInfo(es->str, " Join");
appendStringInfoString(es->str, " Join");
}
else
ExplainPropertyText("Join Type", jointype, es);
......@@ -1182,7 +1182,7 @@ ExplainNode(PlanState *planstate, List *ancestors,
{
if (es->format == EXPLAIN_FORMAT_TEXT)
appendStringInfo(es->str, " (never executed)");
appendStringInfoString(es->str, " (never executed)");
else if (planstate->instrument->need_timer)
{
ExplainPropertyFloat("Actual Startup Time", 0.0, 3, es);
......
......@@ -1523,7 +1523,7 @@ serialize_deflist(List *deflist)
}
appendStringInfoChar(&buf, '\'');
if (lnext(l) != NULL)
appendStringInfo(&buf, ", ");
appendStringInfoString(&buf, ", ");
}
result = cstring_to_text_with_len(buf.data, buf.len);
......
This diff is collapsed.
......@@ -4343,7 +4343,7 @@ ShowUsage(const char *title)
*/
initStringInfo(&str);
appendStringInfo(&str, "! system usage stats:\n");
appendStringInfoString(&str, "! system usage stats:\n");
appendStringInfo(&str,
"!\t%ld.%06ld elapsed %ld.%06ld user %ld.%06ld system sec\n",
(long) (elapse_t.tv_sec - Save_t.tv_sec),
......
......@@ -716,7 +716,7 @@ format_operator_internal(Oid operator_oid, bool force_qualify)
format_type_be_qualified(operform->oprleft) :
format_type_be(operform->oprleft));
else
appendStringInfo(&buf, "NONE,");
appendStringInfoString(&buf, "NONE,");
if (operform->oprright)
appendStringInfo(&buf, "%s)",
......@@ -724,7 +724,7 @@ format_operator_internal(Oid operator_oid, bool force_qualify)
format_type_be_qualified(operform->oprright) :
format_type_be(operform->oprright));
else
appendStringInfo(&buf, "NONE)");
appendStringInfoString(&buf, "NONE)");
result = buf.data;
......
......@@ -427,7 +427,7 @@ RI_FKey_check(TriggerData *trigdata)
querysep = "AND";
queryoids[i] = fk_type;
}
appendStringInfo(&querybuf, " FOR KEY SHARE OF x");
appendStringInfoString(&querybuf, " FOR KEY SHARE OF x");
/* Prepare and save the plan */
qplan = ri_PlanCheck(querybuf.data, riinfo->nkeys, queryoids,
......@@ -562,7 +562,7 @@ ri_Check_Pk_Match(Relation pk_rel, Relation fk_rel,
querysep = "AND";
queryoids[i] = pk_type;
}
appendStringInfo(&querybuf, " FOR KEY SHARE OF x");
appendStringInfoString(&querybuf, " FOR KEY SHARE OF x");
/* Prepare and save the plan */
qplan = ri_PlanCheck(querybuf.data, riinfo->nkeys, queryoids,
......@@ -754,7 +754,7 @@ ri_restrict_del(TriggerData *trigdata, bool is_no_action)
querysep = "AND";
queryoids[i] = pk_type;
}
appendStringInfo(&querybuf, " FOR KEY SHARE OF x");
appendStringInfoString(&querybuf, " FOR KEY SHARE OF x");
/* Prepare and save the plan */
qplan = ri_PlanCheck(querybuf.data, riinfo->nkeys, queryoids,
......@@ -977,7 +977,7 @@ ri_restrict_upd(TriggerData *trigdata, bool is_no_action)
querysep = "AND";
queryoids[i] = pk_type;
}
appendStringInfo(&querybuf, " FOR KEY SHARE OF x");
appendStringInfoString(&querybuf, " FOR KEY SHARE OF x");
/* Prepare and save the plan */
qplan = ri_PlanCheck(querybuf.data, riinfo->nkeys, queryoids,
......@@ -2319,7 +2319,7 @@ RI_Initial_Check(Trigger *trigger, Relation fk_rel, Relation pk_rel)
*----------
*/
initStringInfo(&querybuf);
appendStringInfo(&querybuf, "SELECT ");
appendStringInfoString(&querybuf, "SELECT ");
sep = "";
for (i = 0; i < riinfo->nkeys; i++)
{
......@@ -2391,7 +2391,7 @@ RI_Initial_Check(Trigger *trigger, Relation fk_rel, Relation pk_rel)
break;
}
}
appendStringInfo(&querybuf, ")");
appendStringInfoChar(&querybuf, ')');
/*
* Temporarily increase work_mem so that the check query can be executed
......
This diff is collapsed.
......@@ -442,9 +442,9 @@ xmlcomment(PG_FUNCTION_ARGS)
errmsg("invalid XML comment")));
initStringInfo(&buf);
appendStringInfo(&buf, "<!--");
appendStringInfoString(&buf, "<!--");
appendStringInfoText(&buf, arg);
appendStringInfo(&buf, "-->");
appendStringInfoString(&buf, "-->");
PG_RETURN_XML_P(stringinfo_to_xmltype(&buf));
#else
......@@ -1852,19 +1852,19 @@ map_sql_identifier_to_xml_name(char *ident, bool fully_escaped,
for (p = ident; *p; p += pg_mblen(p))
{
if (*p == ':' && (p == ident || fully_escaped))
appendStringInfo(&buf, "_x003A_");
appendStringInfoString(&buf, "_x003A_");
else if (*p == '_' && *(p + 1) == 'x')
appendStringInfo(&buf, "_x005F_");
appendStringInfoString(&buf, "_x005F_");
else if (fully_escaped && p == ident &&
pg_strncasecmp(p, "xml", 3) == 0)
{
if (*p == 'x')
appendStringInfo(&buf, "_x0078_");
appendStringInfoString(&buf, "_x0078_");
else
appendStringInfo(&buf, "_x0058_");
appendStringInfoString(&buf, "_x0058_");
}
else if (escape_period && *p == '.')
appendStringInfo(&buf, "_x002E_");
appendStringInfoString(&buf, "_x002E_");
else
{
pg_wchar u = sqlchar_to_unicode(p);
......@@ -2438,9 +2438,9 @@ xmldata_root_element_start(StringInfo result, const char *eltname,
if (strlen(targetns) > 0)
appendStringInfo(result, " xsi:schemaLocation=\"%s #\"", targetns);
else
appendStringInfo(result, " xsi:noNamespaceSchemaLocation=\"#\"");
appendStringInfoString(result, " xsi:noNamespaceSchemaLocation=\"#\"");
}
appendStringInfo(result, ">\n");
appendStringInfoString(result, ">\n");
}
......@@ -2945,7 +2945,7 @@ map_multipart_sql_identifier_to_xml_name(char *a, char *b, char *c, char *d)
initStringInfo(&result);
if (a)
appendStringInfo(&result, "%s",
appendStringInfoString(&result,
map_sql_identifier_to_xml_name(a, true, true));
if (b)
appendStringInfo(&result, ".%s",
......@@ -3212,71 +3212,71 @@ map_sql_type_to_xml_name(Oid typeoid, int typmod)
{
case BPCHAROID:
if (typmod == -1)
appendStringInfo(&result, "CHAR");
appendStringInfoString(&result, "CHAR");
else
appendStringInfo(&result, "CHAR_%d", typmod - VARHDRSZ);
break;
case VARCHAROID:
if (typmod == -1)
appendStringInfo(&result, "VARCHAR");
appendStringInfoString(&result, "VARCHAR");
else
appendStringInfo(&result, "VARCHAR_%d", typmod - VARHDRSZ);
break;
case NUMERICOID:
if (typmod == -1)
appendStringInfo(&result, "NUMERIC");
appendStringInfoString(&result, "NUMERIC");
else
appendStringInfo(&result, "NUMERIC_%d_%d",
((typmod - VARHDRSZ) >> 16) & 0xffff,
(typmod - VARHDRSZ) & 0xffff);
break;
case INT4OID:
appendStringInfo(&result, "INTEGER");
appendStringInfoString(&result, "INTEGER");
break;
case INT2OID:
appendStringInfo(&result, "SMALLINT");
appendStringInfoString(&result, "SMALLINT");
break;
case INT8OID:
appendStringInfo(&result, "BIGINT");
appendStringInfoString(&result, "BIGINT");
break;
case FLOAT4OID:
appendStringInfo(&result, "REAL");
appendStringInfoString(&result, "REAL");
break;
case FLOAT8OID:
appendStringInfo(&result, "DOUBLE");
appendStringInfoString(&result, "DOUBLE");
break;
case BOOLOID:
appendStringInfo(&result, "BOOLEAN");
appendStringInfoString(&result, "BOOLEAN");
break;
case TIMEOID:
if (typmod == -1)
appendStringInfo(&result, "TIME");
appendStringInfoString(&result, "TIME");
else
appendStringInfo(&result, "TIME_%d", typmod);
break;
case TIMETZOID:
if (typmod == -1)
appendStringInfo(&result, "TIME_WTZ");
appendStringInfoString(&result, "TIME_WTZ");
else
appendStringInfo(&result, "TIME_WTZ_%d", typmod);
break;
case TIMESTAMPOID:
if (typmod == -1)
appendStringInfo(&result, "TIMESTAMP");
appendStringInfoString(&result, "TIMESTAMP");
else
appendStringInfo(&result, "TIMESTAMP_%d", typmod);
break;
case TIMESTAMPTZOID:
if (typmod == -1)
appendStringInfo(&result, "TIMESTAMP_WTZ");
appendStringInfoString(&result, "TIMESTAMP_WTZ");
else
appendStringInfo(&result, "TIMESTAMP_WTZ_%d", typmod);
break;
case DATEOID:
appendStringInfo(&result, "DATE");
appendStringInfoString(&result, "DATE");
break;
case XMLOID:
appendStringInfo(&result, "XML");
appendStringInfoString(&result, "XML");
break;
default:
{
......@@ -3370,7 +3370,7 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod)
if (typeoid == XMLOID)
{
appendStringInfo(&result,
appendStringInfoString(&result,
"<xsd:complexType mixed=\"true\">\n"
" <xsd:sequence>\n"
" <xsd:any name=\"element\" minOccurs=\"0\" maxOccurs=\"unbounded\" processContents=\"skip\"/>\n"
......@@ -3393,8 +3393,7 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod)
appendStringInfo(&result,
" <xsd:maxLength value=\"%d\"/>\n",
typmod - VARHDRSZ);
appendStringInfo(&result,
" </xsd:restriction>\n");
appendStringInfoString(&result, " </xsd:restriction>\n");
break;
case BYTEAOID:
......@@ -3444,17 +3443,17 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod)
break;
case FLOAT4OID:
appendStringInfo(&result,
appendStringInfoString(&result,
" <xsd:restriction base=\"xsd:float\"></xsd:restriction>\n");
break;
case FLOAT8OID:
appendStringInfo(&result,
appendStringInfoString(&result,
" <xsd:restriction base=\"xsd:double\"></xsd:restriction>\n");
break;
case BOOLOID:
appendStringInfo(&result,
appendStringInfoString(&result,
" <xsd:restriction base=\"xsd:boolean\"></xsd:restriction>\n");
break;
......@@ -3505,7 +3504,7 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod)
}
case DATEOID:
appendStringInfo(&result,
appendStringInfoString(&result,
" <xsd:restriction base=\"xsd:date\">\n"
" <xsd:pattern value=\"\\p{Nd}{4}-\\p{Nd}{2}-\\p{Nd}{2}\"/>\n"
" </xsd:restriction>\n");
......@@ -3525,8 +3524,7 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod)
}
break;
}
appendStringInfo(&result,
"</xsd:simpleType>\n");
appendStringInfoString(&result, "</xsd:simpleType>\n");
}
return result.data;
......
......@@ -372,7 +372,7 @@ incompatible_module_error(const char *libname,
}
if (details.len == 0)
appendStringInfo(&details,
appendStringInfoString(&details,
_("Magic block has unexpected length or padding difference."));
ereport(ERROR,
......
......@@ -6187,7 +6187,7 @@ flatten_set_variable_args(const char *name, List *args)
A_Const *con;
if (l != list_head(args))
appendStringInfo(&buf, ", ");
appendStringInfoString(&buf, ", ");
if (IsA(arg, TypeCast))
{
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment