mirror of
https://github.com/postgres/postgres.git
synced 2025-04-21 12:05:57 +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:
parent
343bb134ea
commit
cacbdd7810
@ -335,18 +335,18 @@ cube_out(PG_FUNCTION_ARGS)
|
|||||||
for (i = 0; i < dim; i++)
|
for (i = 0; i < dim; i++)
|
||||||
{
|
{
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
appendStringInfo(&buf, ", ");
|
appendStringInfoString(&buf, ", ");
|
||||||
appendStringInfo(&buf, "%.*g", ndig, LL_COORD(cube, i));
|
appendStringInfo(&buf, "%.*g", ndig, LL_COORD(cube, i));
|
||||||
}
|
}
|
||||||
appendStringInfoChar(&buf, ')');
|
appendStringInfoChar(&buf, ')');
|
||||||
|
|
||||||
if (!cube_is_point_internal(cube))
|
if (!cube_is_point_internal(cube))
|
||||||
{
|
{
|
||||||
appendStringInfo(&buf, ",(");
|
appendStringInfoString(&buf, ",(");
|
||||||
for (i = 0; i < dim; i++)
|
for (i = 0; i < dim; i++)
|
||||||
{
|
{
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
appendStringInfo(&buf, ", ");
|
appendStringInfoString(&buf, ", ");
|
||||||
appendStringInfo(&buf, "%.*g", ndig, UR_COORD(cube, i));
|
appendStringInfo(&buf, "%.*g", ndig, UR_COORD(cube, i));
|
||||||
}
|
}
|
||||||
appendStringInfoChar(&buf, ')');
|
appendStringInfoChar(&buf, ')');
|
||||||
|
@ -2169,14 +2169,14 @@ get_sql_insert(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (needComma)
|
if (needComma)
|
||||||
appendStringInfo(&buf, ",");
|
appendStringInfoChar(&buf, ',');
|
||||||
|
|
||||||
appendStringInfoString(&buf,
|
appendStringInfoString(&buf,
|
||||||
quote_ident_cstr(NameStr(tupdesc->attrs[i]->attname)));
|
quote_ident_cstr(NameStr(tupdesc->attrs[i]->attname)));
|
||||||
needComma = true;
|
needComma = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
appendStringInfo(&buf, ") VALUES(");
|
appendStringInfoString(&buf, ") VALUES(");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Note: i is physical column number (counting from 0).
|
* 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;
|
continue;
|
||||||
|
|
||||||
if (needComma)
|
if (needComma)
|
||||||
appendStringInfo(&buf, ",");
|
appendStringInfoChar(&buf, ',');
|
||||||
|
|
||||||
key = get_attnum_pk_pos(pkattnums, pknumatts, i);
|
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);
|
pfree(val);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
appendStringInfo(&buf, "NULL");
|
appendStringInfoString(&buf, "NULL");
|
||||||
needComma = true;
|
needComma = true;
|
||||||
}
|
}
|
||||||
appendStringInfo(&buf, ")");
|
appendStringInfoChar(&buf, ')');
|
||||||
|
|
||||||
return (buf.data);
|
return (buf.data);
|
||||||
}
|
}
|
||||||
@ -2232,7 +2232,7 @@ get_sql_delete(Relation rel, int *pkattnums, int pknumatts, char **tgt_pkattvals
|
|||||||
int pkattnum = pkattnums[i];
|
int pkattnum = pkattnums[i];
|
||||||
|
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
appendStringInfo(&buf, " AND ");
|
appendStringInfoString(&buf, " AND ");
|
||||||
|
|
||||||
appendStringInfoString(&buf,
|
appendStringInfoString(&buf,
|
||||||
quote_ident_cstr(NameStr(tupdesc->attrs[pkattnum]->attname)));
|
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",
|
appendStringInfo(&buf, " = %s",
|
||||||
quote_literal_cstr(tgt_pkattvals[i]));
|
quote_literal_cstr(tgt_pkattvals[i]));
|
||||||
else
|
else
|
||||||
appendStringInfo(&buf, " IS NULL");
|
appendStringInfoString(&buf, " IS NULL");
|
||||||
}
|
}
|
||||||
|
|
||||||
return (buf.data);
|
return (buf.data);
|
||||||
@ -2286,7 +2286,7 @@ get_sql_update(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals
|
|||||||
continue;
|
continue;
|
||||||
|
|
||||||
if (needComma)
|
if (needComma)
|
||||||
appendStringInfo(&buf, ", ");
|
appendStringInfoString(&buf, ", ");
|
||||||
|
|
||||||
appendStringInfo(&buf, "%s = ",
|
appendStringInfo(&buf, "%s = ",
|
||||||
quote_ident_cstr(NameStr(tupdesc->attrs[i]->attname)));
|
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;
|
needComma = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
appendStringInfo(&buf, " WHERE ");
|
appendStringInfoString(&buf, " WHERE ");
|
||||||
|
|
||||||
for (i = 0; i < pknumatts; i++)
|
for (i = 0; i < pknumatts; i++)
|
||||||
{
|
{
|
||||||
int pkattnum = pkattnums[i];
|
int pkattnum = pkattnums[i];
|
||||||
|
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
appendStringInfo(&buf, " AND ");
|
appendStringInfoString(&buf, " AND ");
|
||||||
|
|
||||||
appendStringInfo(&buf, "%s",
|
appendStringInfoString(&buf,
|
||||||
quote_ident_cstr(NameStr(tupdesc->attrs[pkattnum]->attname)));
|
quote_ident_cstr(NameStr(tupdesc->attrs[pkattnum]->attname)));
|
||||||
|
|
||||||
val = tgt_pkattvals[i];
|
val = tgt_pkattvals[i];
|
||||||
@ -2325,7 +2325,7 @@ get_sql_update(Relation rel, int *pkattnums, int pknumatts, char **src_pkattvals
|
|||||||
if (val != NULL)
|
if (val != NULL)
|
||||||
appendStringInfo(&buf, " = %s", quote_literal_cstr(val));
|
appendStringInfo(&buf, " = %s", quote_literal_cstr(val));
|
||||||
else
|
else
|
||||||
appendStringInfo(&buf, " IS NULL");
|
appendStringInfoString(&buf, " IS NULL");
|
||||||
}
|
}
|
||||||
|
|
||||||
return (buf.data);
|
return (buf.data);
|
||||||
@ -2419,7 +2419,7 @@ get_tuple_of_interest(Relation rel, int *pkattnums, int pknumatts, char **src_pk
|
|||||||
int pkattnum = pkattnums[i];
|
int pkattnum = pkattnums[i];
|
||||||
|
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
appendStringInfo(&buf, " AND ");
|
appendStringInfoString(&buf, " AND ");
|
||||||
|
|
||||||
appendStringInfoString(&buf,
|
appendStringInfoString(&buf,
|
||||||
quote_ident_cstr(NameStr(tupdesc->attrs[pkattnum]->attname)));
|
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",
|
appendStringInfo(&buf, " = %s",
|
||||||
quote_literal_cstr(src_pkattvals[i]));
|
quote_literal_cstr(src_pkattvals[i]));
|
||||||
else
|
else
|
||||||
appendStringInfo(&buf, " IS NULL");
|
appendStringInfoString(&buf, " IS NULL");
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -1972,7 +1972,7 @@ printSourceNFA(regex_t *regex, TrgmColorInfo *colors, int ncolors)
|
|||||||
|
|
||||||
initStringInfo(&buf);
|
initStringInfo(&buf);
|
||||||
|
|
||||||
appendStringInfo(&buf, "\ndigraph sourceNFA {\n");
|
appendStringInfoString(&buf, "\ndigraph sourceNFA {\n");
|
||||||
|
|
||||||
for (state = 0; state < nstates; state++)
|
for (state = 0; state < nstates; state++)
|
||||||
{
|
{
|
||||||
@ -1982,8 +1982,8 @@ printSourceNFA(regex_t *regex, TrgmColorInfo *colors, int ncolors)
|
|||||||
|
|
||||||
appendStringInfo(&buf, "s%d", state);
|
appendStringInfo(&buf, "s%d", state);
|
||||||
if (pg_reg_getfinalstate(regex) == state)
|
if (pg_reg_getfinalstate(regex) == state)
|
||||||
appendStringInfo(&buf, " [shape = doublecircle]");
|
appendStringInfoString(&buf, " [shape = doublecircle]");
|
||||||
appendStringInfo(&buf, ";\n");
|
appendStringInfoString(&buf, ";\n");
|
||||||
|
|
||||||
arcsCount = pg_reg_getnumoutarcs(regex, state);
|
arcsCount = pg_reg_getnumoutarcs(regex, state);
|
||||||
arcs = (regex_arc_t *) palloc(sizeof(regex_arc_t) * arcsCount);
|
arcs = (regex_arc_t *) palloc(sizeof(regex_arc_t) * arcsCount);
|
||||||
@ -1998,13 +1998,13 @@ printSourceNFA(regex_t *regex, TrgmColorInfo *colors, int ncolors)
|
|||||||
pfree(arcs);
|
pfree(arcs);
|
||||||
}
|
}
|
||||||
|
|
||||||
appendStringInfo(&buf, " node [shape = point ]; initial;\n");
|
appendStringInfoString(&buf, " node [shape = point ]; initial;\n");
|
||||||
appendStringInfo(&buf, " initial -> s%d;\n",
|
appendStringInfo(&buf, " initial -> s%d;\n",
|
||||||
pg_reg_getinitialstate(regex));
|
pg_reg_getinitialstate(regex));
|
||||||
|
|
||||||
/* Print colors */
|
/* Print colors */
|
||||||
appendStringInfo(&buf, " { rank = sink;\n");
|
appendStringInfoString(&buf, " { rank = sink;\n");
|
||||||
appendStringInfo(&buf, " Colors [shape = none, margin=0, label=<\n");
|
appendStringInfoString(&buf, " Colors [shape = none, margin=0, label=<\n");
|
||||||
|
|
||||||
for (i = 0; i < ncolors; i++)
|
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);
|
memcpy(s, color->wordChars[j].bytes, MAX_MULTIBYTE_CHAR_LEN);
|
||||||
s[MAX_MULTIBYTE_CHAR_LEN] = '\0';
|
s[MAX_MULTIBYTE_CHAR_LEN] = '\0';
|
||||||
appendStringInfo(&buf, "%s", s);
|
appendStringInfoString(&buf, s);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
appendStringInfo(&buf, "not expandable");
|
appendStringInfoString(&buf, "not expandable");
|
||||||
appendStringInfo(&buf, "\n");
|
appendStringInfoChar(&buf, '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
appendStringInfo(&buf, " >];\n");
|
appendStringInfoString(&buf, " >];\n");
|
||||||
appendStringInfo(&buf, " }\n");
|
appendStringInfoString(&buf, " }\n");
|
||||||
appendStringInfo(&buf, "}\n");
|
appendStringInfoString(&buf, "}\n");
|
||||||
|
|
||||||
{
|
{
|
||||||
/* dot -Tpng -o /tmp/source.png < /tmp/source.dot */
|
/* dot -Tpng -o /tmp/source.png < /tmp/source.dot */
|
||||||
@ -2056,7 +2056,7 @@ printTrgmNFA(TrgmNFA *trgmNFA)
|
|||||||
|
|
||||||
initStringInfo(&buf);
|
initStringInfo(&buf);
|
||||||
|
|
||||||
appendStringInfo(&buf, "\ndigraph transformedNFA {\n");
|
appendStringInfoString(&buf, "\ndigraph transformedNFA {\n");
|
||||||
|
|
||||||
hash_seq_init(&scan_status, trgmNFA->states);
|
hash_seq_init(&scan_status, trgmNFA->states);
|
||||||
while ((state = (TrgmState *) hash_seq_search(&scan_status)) != NULL)
|
while ((state = (TrgmState *) hash_seq_search(&scan_status)) != NULL)
|
||||||
@ -2065,11 +2065,11 @@ printTrgmNFA(TrgmNFA *trgmNFA)
|
|||||||
|
|
||||||
appendStringInfo(&buf, "s%p", (void *) state);
|
appendStringInfo(&buf, "s%p", (void *) state);
|
||||||
if (state->fin)
|
if (state->fin)
|
||||||
appendStringInfo(&buf, " [shape = doublecircle]");
|
appendStringInfoString(&buf, " [shape = doublecircle]");
|
||||||
if (state->init)
|
if (state->init)
|
||||||
initstate = state;
|
initstate = state;
|
||||||
appendStringInfo(&buf, " [label = \"%d\"]", state->stateKey.nstate);
|
appendStringInfo(&buf, " [label = \"%d\"]", state->stateKey.nstate);
|
||||||
appendStringInfo(&buf, ";\n");
|
appendStringInfoString(&buf, ";\n");
|
||||||
|
|
||||||
foreach(cell, state->arcs)
|
foreach(cell, state->arcs)
|
||||||
{
|
{
|
||||||
@ -2078,21 +2078,21 @@ printTrgmNFA(TrgmNFA *trgmNFA)
|
|||||||
appendStringInfo(&buf, " s%p -> s%p [label = \"",
|
appendStringInfo(&buf, " s%p -> s%p [label = \"",
|
||||||
(void *) state, (void *) arc->target);
|
(void *) state, (void *) arc->target);
|
||||||
printTrgmColor(&buf, arc->ctrgm.colors[0]);
|
printTrgmColor(&buf, arc->ctrgm.colors[0]);
|
||||||
appendStringInfo(&buf, " ");
|
appendStringInfoChar(&buf, ' ');
|
||||||
printTrgmColor(&buf, arc->ctrgm.colors[1]);
|
printTrgmColor(&buf, arc->ctrgm.colors[1]);
|
||||||
appendStringInfo(&buf, " ");
|
appendStringInfoChar(&buf, ' ');
|
||||||
printTrgmColor(&buf, arc->ctrgm.colors[2]);
|
printTrgmColor(&buf, arc->ctrgm.colors[2]);
|
||||||
appendStringInfo(&buf, "\"];\n");
|
appendStringInfoString(&buf, "\"];\n");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (initstate)
|
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, " initial -> s%p;\n", (void *) initstate);
|
||||||
}
|
}
|
||||||
|
|
||||||
appendStringInfo(&buf, "}\n");
|
appendStringInfoString(&buf, "}\n");
|
||||||
|
|
||||||
{
|
{
|
||||||
/* dot -Tpng -o /tmp/transformed.png < /tmp/transformed.dot */
|
/* dot -Tpng -o /tmp/transformed.png < /tmp/transformed.dot */
|
||||||
@ -2112,9 +2112,9 @@ static void
|
|||||||
printTrgmColor(StringInfo buf, TrgmColor co)
|
printTrgmColor(StringInfo buf, TrgmColor co)
|
||||||
{
|
{
|
||||||
if (co == COLOR_UNKNOWN)
|
if (co == COLOR_UNKNOWN)
|
||||||
appendStringInfo(buf, "u");
|
appendStringInfoChar(buf, 'u');
|
||||||
else if (co == COLOR_BLANK)
|
else if (co == COLOR_BLANK)
|
||||||
appendStringInfo(buf, "b");
|
appendStringInfoChar(buf, 'b');
|
||||||
else
|
else
|
||||||
appendStringInfo(buf, "%d", (int) co);
|
appendStringInfo(buf, "%d", (int) co);
|
||||||
}
|
}
|
||||||
@ -2131,7 +2131,7 @@ printTrgmPackedGraph(TrgmPackedGraph *packedGraph, TRGM *trigrams)
|
|||||||
|
|
||||||
initStringInfo(&buf);
|
initStringInfo(&buf);
|
||||||
|
|
||||||
appendStringInfo(&buf, "\ndigraph packedGraph {\n");
|
appendStringInfoString(&buf, "\ndigraph packedGraph {\n");
|
||||||
|
|
||||||
for (i = 0; i < packedGraph->statesCount; i++)
|
for (i = 0; i < packedGraph->statesCount; i++)
|
||||||
{
|
{
|
||||||
@ -2140,7 +2140,7 @@ printTrgmPackedGraph(TrgmPackedGraph *packedGraph, TRGM *trigrams)
|
|||||||
|
|
||||||
appendStringInfo(&buf, " s%d", i);
|
appendStringInfo(&buf, " s%d", i);
|
||||||
if (i == 1)
|
if (i == 1)
|
||||||
appendStringInfo(&buf, " [shape = doublecircle]");
|
appendStringInfoString(&buf, " [shape = doublecircle]");
|
||||||
|
|
||||||
appendStringInfo(&buf, " [label = <s%d>];\n", i);
|
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);
|
appendStringInfo(&buf, " initial -> s%d;\n", 0);
|
||||||
|
|
||||||
/* Print trigrams */
|
/* Print trigrams */
|
||||||
appendStringInfo(&buf, " { rank = sink;\n");
|
appendStringInfoString(&buf, " { rank = sink;\n");
|
||||||
appendStringInfo(&buf, " Trigrams [shape = none, margin=0, label=<\n");
|
appendStringInfoString(&buf, " Trigrams [shape = none, margin=0, label=<\n");
|
||||||
|
|
||||||
p = GETARR(trigrams);
|
p = GETARR(trigrams);
|
||||||
for (i = 0; i < packedGraph->colorTrigramsCount; i++)
|
for (i = 0; i < packedGraph->colorTrigramsCount; i++)
|
||||||
@ -2171,7 +2171,7 @@ printTrgmPackedGraph(TrgmPackedGraph *packedGraph, TRGM *trigrams)
|
|||||||
for (j = 0; j < count; j++)
|
for (j = 0; j < count; j++)
|
||||||
{
|
{
|
||||||
if (j > 0)
|
if (j > 0)
|
||||||
appendStringInfo(&buf, ", ");
|
appendStringInfoString(&buf, ", ");
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* XXX This representation is nice only for all-ASCII trigrams.
|
* XXX This representation is nice only for all-ASCII trigrams.
|
||||||
@ -2181,9 +2181,9 @@ printTrgmPackedGraph(TrgmPackedGraph *packedGraph, TRGM *trigrams)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
appendStringInfo(&buf, " >];\n");
|
appendStringInfoString(&buf, " >];\n");
|
||||||
appendStringInfo(&buf, " }\n");
|
appendStringInfoString(&buf, " }\n");
|
||||||
appendStringInfo(&buf, "}\n");
|
appendStringInfoString(&buf, "}\n");
|
||||||
|
|
||||||
{
|
{
|
||||||
/* dot -Tpng -o /tmp/packed.png < /tmp/packed.dot */
|
/* dot -Tpng -o /tmp/packed.png < /tmp/packed.dot */
|
||||||
|
@ -841,7 +841,7 @@ deparseInsertSql(StringInfo buf, PlannerInfo *root,
|
|||||||
|
|
||||||
if (targetAttrs)
|
if (targetAttrs)
|
||||||
{
|
{
|
||||||
appendStringInfoString(buf, "(");
|
appendStringInfoChar(buf, '(');
|
||||||
|
|
||||||
first = true;
|
first = true;
|
||||||
foreach(lc, targetAttrs)
|
foreach(lc, targetAttrs)
|
||||||
@ -869,7 +869,7 @@ deparseInsertSql(StringInfo buf, PlannerInfo *root,
|
|||||||
pindex++;
|
pindex++;
|
||||||
}
|
}
|
||||||
|
|
||||||
appendStringInfoString(buf, ")");
|
appendStringInfoChar(buf, ')');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
appendStringInfoString(buf, " DEFAULT VALUES");
|
appendStringInfoString(buf, " DEFAULT VALUES");
|
||||||
@ -989,7 +989,7 @@ deparseAnalyzeSizeSql(StringInfo buf, Relation rel)
|
|||||||
initStringInfo(&relname);
|
initStringInfo(&relname);
|
||||||
deparseRelation(&relname, rel);
|
deparseRelation(&relname, rel);
|
||||||
|
|
||||||
appendStringInfo(buf, "SELECT pg_catalog.pg_relation_size(");
|
appendStringInfoString(buf, "SELECT pg_catalog.pg_relation_size(");
|
||||||
deparseStringLiteral(buf, relname.data);
|
deparseStringLiteral(buf, relname.data);
|
||||||
appendStringInfo(buf, "::pg_catalog.regclass) / %d", BLCKSZ);
|
appendStringInfo(buf, "::pg_catalog.regclass) / %d", BLCKSZ);
|
||||||
}
|
}
|
||||||
@ -1302,7 +1302,7 @@ deparseConst(Const *node, deparse_expr_cxt *context)
|
|||||||
|
|
||||||
if (node->constisnull)
|
if (node->constisnull)
|
||||||
{
|
{
|
||||||
appendStringInfo(buf, "NULL");
|
appendStringInfoString(buf, "NULL");
|
||||||
appendStringInfo(buf, "::%s",
|
appendStringInfo(buf, "::%s",
|
||||||
format_type_with_typemod(node->consttype,
|
format_type_with_typemod(node->consttype,
|
||||||
node->consttypmod));
|
node->consttypmod));
|
||||||
@ -1650,7 +1650,7 @@ deparseOperatorName(StringInfo buf, Form_pg_operator opform)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* Just print operator name. */
|
/* Just print operator name. */
|
||||||
appendStringInfo(buf, "%s", opname);
|
appendStringInfoString(buf, opname);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -787,7 +787,7 @@ postgresGetForeignPlan(PlannerInfo *root,
|
|||||||
root->parse->commandType == CMD_DELETE))
|
root->parse->commandType == CMD_DELETE))
|
||||||
{
|
{
|
||||||
/* Relation is UPDATE/DELETE target, so use FOR UPDATE */
|
/* Relation is UPDATE/DELETE target, so use FOR UPDATE */
|
||||||
appendStringInfo(&sql, " FOR UPDATE");
|
appendStringInfoString(&sql, " FOR UPDATE");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -808,11 +808,11 @@ postgresGetForeignPlan(PlannerInfo *root,
|
|||||||
{
|
{
|
||||||
case LCS_FORKEYSHARE:
|
case LCS_FORKEYSHARE:
|
||||||
case LCS_FORSHARE:
|
case LCS_FORSHARE:
|
||||||
appendStringInfo(&sql, " FOR SHARE");
|
appendStringInfoString(&sql, " FOR SHARE");
|
||||||
break;
|
break;
|
||||||
case LCS_FORNOKEYUPDATE:
|
case LCS_FORNOKEYUPDATE:
|
||||||
case LCS_FORUPDATE:
|
case LCS_FORUPDATE:
|
||||||
appendStringInfo(&sql, " FOR UPDATE");
|
appendStringInfoString(&sql, " FOR UPDATE");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1340,7 +1340,7 @@ build_tuplestore_recursively(char *key_fld,
|
|||||||
for (i = 0; i < proc; i++)
|
for (i = 0; i < proc; i++)
|
||||||
{
|
{
|
||||||
/* initialize branch for this pass */
|
/* initialize branch for this pass */
|
||||||
appendStringInfo(&branchstr, "%s", branch);
|
appendStringInfoString(&branchstr, branch);
|
||||||
appendStringInfo(&chk_branchstr, "%s%s%s", branch_delim, branch, branch_delim);
|
appendStringInfo(&chk_branchstr, "%s%s%s", branch_delim, branch, branch_delim);
|
||||||
|
|
||||||
/* get the next sql result tuple */
|
/* 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);
|
appendStringInfo(buf, "truncate before: %d", pageno);
|
||||||
}
|
}
|
||||||
else
|
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);
|
xlrec->db_id, xlrec->tablespace_id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
appendStringInfo(buf, "UNKNOWN");
|
appendStringInfoString(buf, "UNKNOWN");
|
||||||
}
|
}
|
||||||
|
@ -33,15 +33,15 @@ gin_desc(StringInfo buf, uint8 xl_info, char *rec)
|
|||||||
switch (info)
|
switch (info)
|
||||||
{
|
{
|
||||||
case XLOG_GIN_CREATE_INDEX:
|
case XLOG_GIN_CREATE_INDEX:
|
||||||
appendStringInfo(buf, "Create index, ");
|
appendStringInfoString(buf, "Create index, ");
|
||||||
desc_node(buf, *(RelFileNode *) rec, GIN_ROOT_BLKNO);
|
desc_node(buf, *(RelFileNode *) rec, GIN_ROOT_BLKNO);
|
||||||
break;
|
break;
|
||||||
case XLOG_GIN_CREATE_PTREE:
|
case XLOG_GIN_CREATE_PTREE:
|
||||||
appendStringInfo(buf, "Create posting tree, ");
|
appendStringInfoString(buf, "Create posting tree, ");
|
||||||
desc_node(buf, ((ginxlogCreatePostingTree *) rec)->node, ((ginxlogCreatePostingTree *) rec)->blkno);
|
desc_node(buf, ((ginxlogCreatePostingTree *) rec)->node, ((ginxlogCreatePostingTree *) rec)->blkno);
|
||||||
break;
|
break;
|
||||||
case XLOG_GIN_INSERT:
|
case XLOG_GIN_INSERT:
|
||||||
appendStringInfo(buf, "Insert item, ");
|
appendStringInfoString(buf, "Insert item, ");
|
||||||
desc_node(buf, ((ginxlogInsert *) rec)->node, ((ginxlogInsert *) rec)->blkno);
|
desc_node(buf, ((ginxlogInsert *) rec)->node, ((ginxlogInsert *) rec)->blkno);
|
||||||
appendStringInfo(buf, " offset: %u nitem: %u isdata: %c isleaf %c isdelete %c updateBlkno:%u",
|
appendStringInfo(buf, " offset: %u nitem: %u isdata: %c isleaf %c isdelete %c updateBlkno:%u",
|
||||||
((ginxlogInsert *) rec)->offset,
|
((ginxlogInsert *) rec)->offset,
|
||||||
@ -52,24 +52,24 @@ gin_desc(StringInfo buf, uint8 xl_info, char *rec)
|
|||||||
((ginxlogInsert *) rec)->updateBlkno);
|
((ginxlogInsert *) rec)->updateBlkno);
|
||||||
break;
|
break;
|
||||||
case XLOG_GIN_SPLIT:
|
case XLOG_GIN_SPLIT:
|
||||||
appendStringInfo(buf, "Page split, ");
|
appendStringInfoString(buf, "Page split, ");
|
||||||
desc_node(buf, ((ginxlogSplit *) rec)->node, ((ginxlogSplit *) rec)->lblkno);
|
desc_node(buf, ((ginxlogSplit *) rec)->node, ((ginxlogSplit *) rec)->lblkno);
|
||||||
appendStringInfo(buf, " isrootsplit: %c", (((ginxlogSplit *) rec)->isRootSplit) ? 'T' : 'F');
|
appendStringInfo(buf, " isrootsplit: %c", (((ginxlogSplit *) rec)->isRootSplit) ? 'T' : 'F');
|
||||||
break;
|
break;
|
||||||
case XLOG_GIN_VACUUM_PAGE:
|
case XLOG_GIN_VACUUM_PAGE:
|
||||||
appendStringInfo(buf, "Vacuum page, ");
|
appendStringInfoString(buf, "Vacuum page, ");
|
||||||
desc_node(buf, ((ginxlogVacuumPage *) rec)->node, ((ginxlogVacuumPage *) rec)->blkno);
|
desc_node(buf, ((ginxlogVacuumPage *) rec)->node, ((ginxlogVacuumPage *) rec)->blkno);
|
||||||
break;
|
break;
|
||||||
case XLOG_GIN_DELETE_PAGE:
|
case XLOG_GIN_DELETE_PAGE:
|
||||||
appendStringInfo(buf, "Delete page, ");
|
appendStringInfoString(buf, "Delete page, ");
|
||||||
desc_node(buf, ((ginxlogDeletePage *) rec)->node, ((ginxlogDeletePage *) rec)->blkno);
|
desc_node(buf, ((ginxlogDeletePage *) rec)->node, ((ginxlogDeletePage *) rec)->blkno);
|
||||||
break;
|
break;
|
||||||
case XLOG_GIN_UPDATE_META_PAGE:
|
case XLOG_GIN_UPDATE_META_PAGE:
|
||||||
appendStringInfo(buf, "Update metapage, ");
|
appendStringInfoString(buf, "Update metapage, ");
|
||||||
desc_node(buf, ((ginxlogUpdateMeta *) rec)->node, GIN_METAPAGE_BLKNO);
|
desc_node(buf, ((ginxlogUpdateMeta *) rec)->node, GIN_METAPAGE_BLKNO);
|
||||||
break;
|
break;
|
||||||
case XLOG_GIN_INSERT_LISTPAGE:
|
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);
|
desc_node(buf, ((ginxlogInsertListPage *) rec)->node, ((ginxlogInsertListPage *) rec)->blkno);
|
||||||
break;
|
break;
|
||||||
case XLOG_GIN_DELETE_LISTPAGE:
|
case XLOG_GIN_DELETE_LISTPAGE:
|
||||||
|
@ -35,7 +35,7 @@ out_gistxlogPageUpdate(StringInfo buf, gistxlogPageUpdate *xlrec)
|
|||||||
static void
|
static void
|
||||||
out_gistxlogPageSplit(StringInfo buf, gistxlogPageSplit *xlrec)
|
out_gistxlogPageSplit(StringInfo buf, gistxlogPageSplit *xlrec)
|
||||||
{
|
{
|
||||||
appendStringInfo(buf, "page_split: ");
|
appendStringInfoString(buf, "page_split: ");
|
||||||
out_target(buf, xlrec->node);
|
out_target(buf, xlrec->node);
|
||||||
appendStringInfo(buf, "; block number %u splits to %d pages",
|
appendStringInfo(buf, "; block number %u splits to %d pages",
|
||||||
xlrec->origblkno, xlrec->npage);
|
xlrec->origblkno, xlrec->npage);
|
||||||
@ -49,7 +49,7 @@ gist_desc(StringInfo buf, uint8 xl_info, char *rec)
|
|||||||
switch (info)
|
switch (info)
|
||||||
{
|
{
|
||||||
case XLOG_GIST_PAGE_UPDATE:
|
case XLOG_GIST_PAGE_UPDATE:
|
||||||
appendStringInfo(buf, "page_update: ");
|
appendStringInfoString(buf, "page_update: ");
|
||||||
out_gistxlogPageUpdate(buf, (gistxlogPageUpdate *) rec);
|
out_gistxlogPageUpdate(buf, (gistxlogPageUpdate *) rec);
|
||||||
break;
|
break;
|
||||||
case XLOG_GIST_PAGE_SPLIT:
|
case XLOG_GIST_PAGE_SPLIT:
|
||||||
|
@ -29,15 +29,15 @@ static void
|
|||||||
out_infobits(StringInfo buf, uint8 infobits)
|
out_infobits(StringInfo buf, uint8 infobits)
|
||||||
{
|
{
|
||||||
if (infobits & XLHL_XMAX_IS_MULTI)
|
if (infobits & XLHL_XMAX_IS_MULTI)
|
||||||
appendStringInfo(buf, "IS_MULTI ");
|
appendStringInfoString(buf, "IS_MULTI ");
|
||||||
if (infobits & XLHL_XMAX_LOCK_ONLY)
|
if (infobits & XLHL_XMAX_LOCK_ONLY)
|
||||||
appendStringInfo(buf, "LOCK_ONLY ");
|
appendStringInfoString(buf, "LOCK_ONLY ");
|
||||||
if (infobits & XLHL_XMAX_EXCL_LOCK)
|
if (infobits & XLHL_XMAX_EXCL_LOCK)
|
||||||
appendStringInfo(buf, "EXCL_LOCK ");
|
appendStringInfoString(buf, "EXCL_LOCK ");
|
||||||
if (infobits & XLHL_XMAX_KEYSHR_LOCK)
|
if (infobits & XLHL_XMAX_KEYSHR_LOCK)
|
||||||
appendStringInfo(buf, "KEYSHR_LOCK ");
|
appendStringInfoString(buf, "KEYSHR_LOCK ");
|
||||||
if (infobits & XLHL_KEYS_UPDATED)
|
if (infobits & XLHL_KEYS_UPDATED)
|
||||||
appendStringInfo(buf, "KEYS_UPDATED ");
|
appendStringInfoString(buf, "KEYS_UPDATED ");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -51,16 +51,16 @@ heap_desc(StringInfo buf, uint8 xl_info, char *rec)
|
|||||||
xl_heap_insert *xlrec = (xl_heap_insert *) rec;
|
xl_heap_insert *xlrec = (xl_heap_insert *) rec;
|
||||||
|
|
||||||
if (xl_info & XLOG_HEAP_INIT_PAGE)
|
if (xl_info & XLOG_HEAP_INIT_PAGE)
|
||||||
appendStringInfo(buf, "insert(init): ");
|
appendStringInfoString(buf, "insert(init): ");
|
||||||
else
|
else
|
||||||
appendStringInfo(buf, "insert: ");
|
appendStringInfoString(buf, "insert: ");
|
||||||
out_target(buf, &(xlrec->target));
|
out_target(buf, &(xlrec->target));
|
||||||
}
|
}
|
||||||
else if (info == XLOG_HEAP_DELETE)
|
else if (info == XLOG_HEAP_DELETE)
|
||||||
{
|
{
|
||||||
xl_heap_delete *xlrec = (xl_heap_delete *) rec;
|
xl_heap_delete *xlrec = (xl_heap_delete *) rec;
|
||||||
|
|
||||||
appendStringInfo(buf, "delete: ");
|
appendStringInfoString(buf, "delete: ");
|
||||||
out_target(buf, &(xlrec->target));
|
out_target(buf, &(xlrec->target));
|
||||||
appendStringInfoChar(buf, ' ');
|
appendStringInfoChar(buf, ' ');
|
||||||
out_infobits(buf, xlrec->infobits_set);
|
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;
|
xl_heap_update *xlrec = (xl_heap_update *) rec;
|
||||||
|
|
||||||
if (xl_info & XLOG_HEAP_INIT_PAGE)
|
if (xl_info & XLOG_HEAP_INIT_PAGE)
|
||||||
appendStringInfo(buf, "update(init): ");
|
appendStringInfoString(buf, "update(init): ");
|
||||||
else
|
else
|
||||||
appendStringInfo(buf, "update: ");
|
appendStringInfoString(buf, "update: ");
|
||||||
out_target(buf, &(xlrec->target));
|
out_target(buf, &(xlrec->target));
|
||||||
appendStringInfo(buf, " xmax %u ", xlrec->old_xmax);
|
appendStringInfo(buf, " xmax %u ", xlrec->old_xmax);
|
||||||
out_infobits(buf, xlrec->old_infobits_set);
|
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;
|
xl_heap_update *xlrec = (xl_heap_update *) rec;
|
||||||
|
|
||||||
if (xl_info & XLOG_HEAP_INIT_PAGE) /* can this case happen? */
|
if (xl_info & XLOG_HEAP_INIT_PAGE) /* can this case happen? */
|
||||||
appendStringInfo(buf, "hot_update(init): ");
|
appendStringInfoString(buf, "hot_update(init): ");
|
||||||
else
|
else
|
||||||
appendStringInfo(buf, "hot_update: ");
|
appendStringInfoString(buf, "hot_update: ");
|
||||||
out_target(buf, &(xlrec->target));
|
out_target(buf, &(xlrec->target));
|
||||||
appendStringInfo(buf, " xmax %u ", xlrec->old_xmax);
|
appendStringInfo(buf, " xmax %u ", xlrec->old_xmax);
|
||||||
out_infobits(buf, xlrec->old_infobits_set);
|
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;
|
xl_heap_inplace *xlrec = (xl_heap_inplace *) rec;
|
||||||
|
|
||||||
appendStringInfo(buf, "inplace: ");
|
appendStringInfoString(buf, "inplace: ");
|
||||||
out_target(buf, &(xlrec->target));
|
out_target(buf, &(xlrec->target));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
appendStringInfo(buf, "UNKNOWN");
|
appendStringInfoString(buf, "UNKNOWN");
|
||||||
}
|
}
|
||||||
void
|
void
|
||||||
heap2_desc(StringInfo buf, uint8 xl_info, char *rec)
|
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;
|
xl_heap_multi_insert *xlrec = (xl_heap_multi_insert *) rec;
|
||||||
|
|
||||||
if (xl_info & XLOG_HEAP_INIT_PAGE)
|
if (xl_info & XLOG_HEAP_INIT_PAGE)
|
||||||
appendStringInfo(buf, "multi-insert (init): ");
|
appendStringInfoString(buf, "multi-insert (init): ");
|
||||||
else
|
else
|
||||||
appendStringInfo(buf, "multi-insert: ");
|
appendStringInfoString(buf, "multi-insert: ");
|
||||||
appendStringInfo(buf, "rel %u/%u/%u; blk %u; %d tuples",
|
appendStringInfo(buf, "rel %u/%u/%u; blk %u; %d tuples",
|
||||||
xlrec->node.spcNode, xlrec->node.dbNode, xlrec->node.relNode,
|
xlrec->node.spcNode, xlrec->node.dbNode, xlrec->node.relNode,
|
||||||
xlrec->blkno, xlrec->ntuples);
|
xlrec->blkno, xlrec->ntuples);
|
||||||
@ -185,5 +185,5 @@ heap2_desc(StringInfo buf, uint8 xl_info, char *rec)
|
|||||||
out_target(buf, &(xlrec->target));
|
out_target(buf, &(xlrec->target));
|
||||||
}
|
}
|
||||||
else
|
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]);
|
out_member(buf, &xlrec->members[i]);
|
||||||
}
|
}
|
||||||
else
|
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;
|
xl_btree_insert *xlrec = (xl_btree_insert *) rec;
|
||||||
|
|
||||||
appendStringInfo(buf, "insert: ");
|
appendStringInfoString(buf, "insert: ");
|
||||||
out_target(buf, &(xlrec->target));
|
out_target(buf, &(xlrec->target));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -44,7 +44,7 @@ btree_desc(StringInfo buf, uint8 xl_info, char *rec)
|
|||||||
{
|
{
|
||||||
xl_btree_insert *xlrec = (xl_btree_insert *) rec;
|
xl_btree_insert *xlrec = (xl_btree_insert *) rec;
|
||||||
|
|
||||||
appendStringInfo(buf, "insert_upper: ");
|
appendStringInfoString(buf, "insert_upper: ");
|
||||||
out_target(buf, &(xlrec->target));
|
out_target(buf, &(xlrec->target));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -52,7 +52,7 @@ btree_desc(StringInfo buf, uint8 xl_info, char *rec)
|
|||||||
{
|
{
|
||||||
xl_btree_insert *xlrec = (xl_btree_insert *) rec;
|
xl_btree_insert *xlrec = (xl_btree_insert *) rec;
|
||||||
|
|
||||||
appendStringInfo(buf, "insert_meta: ");
|
appendStringInfoString(buf, "insert_meta: ");
|
||||||
out_target(buf, &(xlrec->target));
|
out_target(buf, &(xlrec->target));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -130,7 +130,7 @@ btree_desc(StringInfo buf, uint8 xl_info, char *rec)
|
|||||||
{
|
{
|
||||||
xl_btree_delete_page *xlrec = (xl_btree_delete_page *) rec;
|
xl_btree_delete_page *xlrec = (xl_btree_delete_page *) rec;
|
||||||
|
|
||||||
appendStringInfo(buf, "delete_page: ");
|
appendStringInfoString(buf, "delete_page: ");
|
||||||
out_target(buf, &(xlrec->target));
|
out_target(buf, &(xlrec->target));
|
||||||
appendStringInfo(buf, "; dead %u; left %u; right %u",
|
appendStringInfo(buf, "; dead %u; left %u; right %u",
|
||||||
xlrec->deadblk, xlrec->leftblk, xlrec->rightblk);
|
xlrec->deadblk, xlrec->leftblk, xlrec->rightblk);
|
||||||
@ -156,7 +156,7 @@ btree_desc(StringInfo buf, uint8 xl_info, char *rec)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
appendStringInfo(buf, "UNKNOWN");
|
appendStringInfoString(buf, "UNKNOWN");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -29,5 +29,5 @@ relmap_desc(StringInfo buf, uint8 xl_info, char *rec)
|
|||||||
xlrec->dbid, xlrec->tsid, xlrec->nbytes);
|
xlrec->dbid, xlrec->tsid, xlrec->nbytes);
|
||||||
}
|
}
|
||||||
else
|
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;
|
xl_seq_rec *xlrec = (xl_seq_rec *) rec;
|
||||||
|
|
||||||
if (info == XLOG_SEQ_LOG)
|
if (info == XLOG_SEQ_LOG)
|
||||||
appendStringInfo(buf, "log: ");
|
appendStringInfoString(buf, "log: ");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
appendStringInfo(buf, "UNKNOWN");
|
appendStringInfoString(buf, "UNKNOWN");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -42,5 +42,5 @@ smgr_desc(StringInfo buf, uint8 xl_info, char *rec)
|
|||||||
pfree(path);
|
pfree(path);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
appendStringInfo(buf, "UNKNOWN");
|
appendStringInfoString(buf, "UNKNOWN");
|
||||||
}
|
}
|
||||||
|
@ -64,7 +64,7 @@ spg_desc(StringInfo buf, uint8 xl_info, char *rec)
|
|||||||
break;
|
break;
|
||||||
case XLOG_SPGIST_PICKSPLIT:
|
case XLOG_SPGIST_PICKSPLIT:
|
||||||
out_target(buf, ((spgxlogPickSplit *) rec)->node);
|
out_target(buf, ((spgxlogPickSplit *) rec)->node);
|
||||||
appendStringInfo(buf, "split leaf page");
|
appendStringInfoString(buf, "split leaf page");
|
||||||
break;
|
break;
|
||||||
case XLOG_SPGIST_VACUUM_LEAF:
|
case XLOG_SPGIST_VACUUM_LEAF:
|
||||||
out_target(buf, ((spgxlogVacuumLeaf *) rec)->node);
|
out_target(buf, ((spgxlogVacuumLeaf *) rec)->node);
|
||||||
|
@ -33,7 +33,7 @@ standby_desc_running_xacts(StringInfo buf, xl_running_xacts *xlrec)
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (xlrec->subxid_overflow)
|
if (xlrec->subxid_overflow)
|
||||||
appendStringInfo(buf, "; subxid ovf");
|
appendStringInfoString(buf, "; subxid ovf");
|
||||||
}
|
}
|
||||||
|
|
||||||
void
|
void
|
||||||
@ -46,7 +46,7 @@ standby_desc(StringInfo buf, uint8 xl_info, char *rec)
|
|||||||
xl_standby_locks *xlrec = (xl_standby_locks *) rec;
|
xl_standby_locks *xlrec = (xl_standby_locks *) rec;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
appendStringInfo(buf, "AccessExclusive locks:");
|
appendStringInfoString(buf, "AccessExclusive locks:");
|
||||||
|
|
||||||
for (i = 0; i < xlrec->nlocks; i++)
|
for (i = 0; i < xlrec->nlocks; i++)
|
||||||
appendStringInfo(buf, " xid %u db %u rel %u",
|
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;
|
xl_running_xacts *xlrec = (xl_running_xacts *) rec;
|
||||||
|
|
||||||
appendStringInfo(buf, "running xacts:");
|
appendStringInfoString(buf, "running xacts:");
|
||||||
standby_desc_running_xacts(buf, xlrec);
|
standby_desc_running_xacts(buf, xlrec);
|
||||||
}
|
}
|
||||||
else
|
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);
|
appendStringInfo(buf, "drop tablespace: %u", xlrec->ts_id);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
appendStringInfo(buf, "UNKNOWN");
|
appendStringInfoString(buf, "UNKNOWN");
|
||||||
}
|
}
|
||||||
|
@ -33,7 +33,7 @@ xact_desc_commit(StringInfo buf, xl_xact_commit *xlrec)
|
|||||||
|
|
||||||
if (xlrec->nrels > 0)
|
if (xlrec->nrels > 0)
|
||||||
{
|
{
|
||||||
appendStringInfo(buf, "; rels:");
|
appendStringInfoString(buf, "; rels:");
|
||||||
for (i = 0; i < xlrec->nrels; i++)
|
for (i = 0; i < xlrec->nrels; i++)
|
||||||
{
|
{
|
||||||
char *path = relpathperm(xlrec->xnodes[i], MAIN_FORKNUM);
|
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)
|
if (xlrec->nsubxacts > 0)
|
||||||
{
|
{
|
||||||
appendStringInfo(buf, "; subxacts:");
|
appendStringInfoString(buf, "; subxacts:");
|
||||||
for (i = 0; i < xlrec->nsubxacts; i++)
|
for (i = 0; i < xlrec->nsubxacts; i++)
|
||||||
appendStringInfo(buf, " %u", subxacts[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",
|
appendStringInfo(buf, "; relcache init file inval dbid %u tsid %u",
|
||||||
xlrec->dbId, xlrec->tsId);
|
xlrec->dbId, xlrec->tsId);
|
||||||
|
|
||||||
appendStringInfo(buf, "; inval msgs:");
|
appendStringInfoString(buf, "; inval msgs:");
|
||||||
for (i = 0; i < xlrec->nmsgs; i++)
|
for (i = 0; i < xlrec->nmsgs; i++)
|
||||||
{
|
{
|
||||||
SharedInvalidationMessage *msg = &msgs[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);
|
appendStringInfo(buf, " relcache %u", msg->rc.relId);
|
||||||
/* not expected, but print something anyway */
|
/* not expected, but print something anyway */
|
||||||
else if (msg->id == SHAREDINVALSMGR_ID)
|
else if (msg->id == SHAREDINVALSMGR_ID)
|
||||||
appendStringInfo(buf, " smgr");
|
appendStringInfoString(buf, " smgr");
|
||||||
/* not expected, but print something anyway */
|
/* not expected, but print something anyway */
|
||||||
else if (msg->id == SHAREDINVALRELMAP_ID)
|
else if (msg->id == SHAREDINVALRELMAP_ID)
|
||||||
appendStringInfo(buf, " relmap");
|
appendStringInfoString(buf, " relmap");
|
||||||
else if (msg->id == SHAREDINVALSNAPSHOT_ID)
|
else if (msg->id == SHAREDINVALSNAPSHOT_ID)
|
||||||
appendStringInfo(buf, " snapshot %u", msg->sn.relId);
|
appendStringInfo(buf, " snapshot %u", msg->sn.relId);
|
||||||
else
|
else
|
||||||
@ -92,7 +92,7 @@ xact_desc_commit_compact(StringInfo buf, xl_xact_commit_compact *xlrec)
|
|||||||
|
|
||||||
if (xlrec->nsubxacts > 0)
|
if (xlrec->nsubxacts > 0)
|
||||||
{
|
{
|
||||||
appendStringInfo(buf, "; subxacts:");
|
appendStringInfoString(buf, "; subxacts:");
|
||||||
for (i = 0; i < xlrec->nsubxacts; i++)
|
for (i = 0; i < xlrec->nsubxacts; i++)
|
||||||
appendStringInfo(buf, " %u", xlrec->subxacts[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));
|
appendStringInfoString(buf, timestamptz_to_str(xlrec->xact_time));
|
||||||
if (xlrec->nrels > 0)
|
if (xlrec->nrels > 0)
|
||||||
{
|
{
|
||||||
appendStringInfo(buf, "; rels:");
|
appendStringInfoString(buf, "; rels:");
|
||||||
for (i = 0; i < xlrec->nrels; i++)
|
for (i = 0; i < xlrec->nrels; i++)
|
||||||
{
|
{
|
||||||
char *path = relpathperm(xlrec->xnodes[i], MAIN_FORKNUM);
|
char *path = relpathperm(xlrec->xnodes[i], MAIN_FORKNUM);
|
||||||
@ -120,7 +120,7 @@ xact_desc_abort(StringInfo buf, xl_xact_abort *xlrec)
|
|||||||
TransactionId *xacts = (TransactionId *)
|
TransactionId *xacts = (TransactionId *)
|
||||||
&xlrec->xnodes[xlrec->nrels];
|
&xlrec->xnodes[xlrec->nrels];
|
||||||
|
|
||||||
appendStringInfo(buf, "; subxacts:");
|
appendStringInfoString(buf, "; subxacts:");
|
||||||
for (i = 0; i < xlrec->nsubxacts; i++)
|
for (i = 0; i < xlrec->nsubxacts; i++)
|
||||||
appendStringInfo(buf, " %u", xacts[i]);
|
appendStringInfo(buf, " %u", xacts[i]);
|
||||||
}
|
}
|
||||||
@ -131,7 +131,7 @@ xact_desc_assignment(StringInfo buf, xl_xact_assignment *xlrec)
|
|||||||
{
|
{
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
appendStringInfo(buf, "subxacts:");
|
appendStringInfoString(buf, "subxacts:");
|
||||||
|
|
||||||
for (i = 0; i < xlrec->nsubxacts; i++)
|
for (i = 0; i < xlrec->nsubxacts; i++)
|
||||||
appendStringInfo(buf, " %u", xlrec->xsub[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;
|
xl_xact_commit_compact *xlrec = (xl_xact_commit_compact *) rec;
|
||||||
|
|
||||||
appendStringInfo(buf, "commit: ");
|
appendStringInfoString(buf, "commit: ");
|
||||||
xact_desc_commit_compact(buf, xlrec);
|
xact_desc_commit_compact(buf, xlrec);
|
||||||
}
|
}
|
||||||
else if (info == XLOG_XACT_COMMIT)
|
else if (info == XLOG_XACT_COMMIT)
|
||||||
{
|
{
|
||||||
xl_xact_commit *xlrec = (xl_xact_commit *) rec;
|
xl_xact_commit *xlrec = (xl_xact_commit *) rec;
|
||||||
|
|
||||||
appendStringInfo(buf, "commit: ");
|
appendStringInfoString(buf, "commit: ");
|
||||||
xact_desc_commit(buf, xlrec);
|
xact_desc_commit(buf, xlrec);
|
||||||
}
|
}
|
||||||
else if (info == XLOG_XACT_ABORT)
|
else if (info == XLOG_XACT_ABORT)
|
||||||
{
|
{
|
||||||
xl_xact_abort *xlrec = (xl_xact_abort *) rec;
|
xl_xact_abort *xlrec = (xl_xact_abort *) rec;
|
||||||
|
|
||||||
appendStringInfo(buf, "abort: ");
|
appendStringInfoString(buf, "abort: ");
|
||||||
xact_desc_abort(buf, xlrec);
|
xact_desc_abort(buf, xlrec);
|
||||||
}
|
}
|
||||||
else if (info == XLOG_XACT_PREPARE)
|
else if (info == XLOG_XACT_PREPARE)
|
||||||
{
|
{
|
||||||
appendStringInfo(buf, "prepare");
|
appendStringInfoString(buf, "prepare");
|
||||||
}
|
}
|
||||||
else if (info == XLOG_XACT_COMMIT_PREPARED)
|
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);
|
xact_desc_assignment(buf, xlrec);
|
||||||
}
|
}
|
||||||
else
|
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)
|
else if (info == XLOG_NOOP)
|
||||||
{
|
{
|
||||||
appendStringInfo(buf, "xlog no-op");
|
appendStringInfoString(buf, "xlog no-op");
|
||||||
}
|
}
|
||||||
else if (info == XLOG_NEXTOID)
|
else if (info == XLOG_NEXTOID)
|
||||||
{
|
{
|
||||||
@ -73,7 +73,7 @@ xlog_desc(StringInfo buf, uint8 xl_info, char *rec)
|
|||||||
}
|
}
|
||||||
else if (info == XLOG_SWITCH)
|
else if (info == XLOG_SWITCH)
|
||||||
{
|
{
|
||||||
appendStringInfo(buf, "xlog switch");
|
appendStringInfoString(buf, "xlog switch");
|
||||||
}
|
}
|
||||||
else if (info == XLOG_RESTORE_POINT)
|
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));
|
timestamptz_to_str(xlrec.end_time));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
appendStringInfo(buf, "UNKNOWN");
|
appendStringInfoString(buf, "UNKNOWN");
|
||||||
}
|
}
|
||||||
|
@ -1248,7 +1248,7 @@ begin:;
|
|||||||
xlog_outrec(&buf, rechdr);
|
xlog_outrec(&buf, rechdr);
|
||||||
if (rdata->data != NULL)
|
if (rdata->data != NULL)
|
||||||
{
|
{
|
||||||
appendStringInfo(&buf, " - ");
|
appendStringInfoString(&buf, " - ");
|
||||||
RmgrTable[rechdr->xl_rmid].rm_desc(&buf, rechdr->xl_info, rdata->data);
|
RmgrTable[rechdr->xl_rmid].rm_desc(&buf, rechdr->xl_info, rdata->data);
|
||||||
}
|
}
|
||||||
elog(LOG, "%s", buf.data);
|
elog(LOG, "%s", buf.data);
|
||||||
@ -6677,7 +6677,7 @@ StartupXLOG(void)
|
|||||||
(uint32) (ReadRecPtr >> 32), (uint32) ReadRecPtr,
|
(uint32) (ReadRecPtr >> 32), (uint32) ReadRecPtr,
|
||||||
(uint32) (EndRecPtr >> 32), (uint32) EndRecPtr);
|
(uint32) (EndRecPtr >> 32), (uint32) EndRecPtr);
|
||||||
xlog_outrec(&buf, record);
|
xlog_outrec(&buf, record);
|
||||||
appendStringInfo(&buf, " - ");
|
appendStringInfoString(&buf, " - ");
|
||||||
RmgrTable[record->xl_rmid].rm_desc(&buf,
|
RmgrTable[record->xl_rmid].rm_desc(&buf,
|
||||||
record->xl_info,
|
record->xl_info,
|
||||||
XLogRecGetData(record));
|
XLogRecGetData(record));
|
||||||
|
@ -2439,15 +2439,15 @@ getObjectTypeDescription(const ObjectAddress *object)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_TYPE:
|
case OCLASS_TYPE:
|
||||||
appendStringInfo(&buffer, "type");
|
appendStringInfoString(&buffer, "type");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_CAST:
|
case OCLASS_CAST:
|
||||||
appendStringInfo(&buffer, "cast");
|
appendStringInfoString(&buffer, "cast");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_COLLATION:
|
case OCLASS_COLLATION:
|
||||||
appendStringInfo(&buffer, "collation");
|
appendStringInfoString(&buffer, "collation");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_CONSTRAINT:
|
case OCLASS_CONSTRAINT:
|
||||||
@ -2455,103 +2455,103 @@ getObjectTypeDescription(const ObjectAddress *object)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_CONVERSION:
|
case OCLASS_CONVERSION:
|
||||||
appendStringInfo(&buffer, "conversion");
|
appendStringInfoString(&buffer, "conversion");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_DEFAULT:
|
case OCLASS_DEFAULT:
|
||||||
appendStringInfo(&buffer, "default value");
|
appendStringInfoString(&buffer, "default value");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_LANGUAGE:
|
case OCLASS_LANGUAGE:
|
||||||
appendStringInfo(&buffer, "language");
|
appendStringInfoString(&buffer, "language");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_LARGEOBJECT:
|
case OCLASS_LARGEOBJECT:
|
||||||
appendStringInfo(&buffer, "large object");
|
appendStringInfoString(&buffer, "large object");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_OPERATOR:
|
case OCLASS_OPERATOR:
|
||||||
appendStringInfo(&buffer, "operator");
|
appendStringInfoString(&buffer, "operator");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_OPCLASS:
|
case OCLASS_OPCLASS:
|
||||||
appendStringInfo(&buffer, "operator class");
|
appendStringInfoString(&buffer, "operator class");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_OPFAMILY:
|
case OCLASS_OPFAMILY:
|
||||||
appendStringInfo(&buffer, "operator family");
|
appendStringInfoString(&buffer, "operator family");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_AMOP:
|
case OCLASS_AMOP:
|
||||||
appendStringInfo(&buffer, "operator of access method");
|
appendStringInfoString(&buffer, "operator of access method");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_AMPROC:
|
case OCLASS_AMPROC:
|
||||||
appendStringInfo(&buffer, "function of access method");
|
appendStringInfoString(&buffer, "function of access method");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_REWRITE:
|
case OCLASS_REWRITE:
|
||||||
appendStringInfo(&buffer, "rule");
|
appendStringInfoString(&buffer, "rule");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_TRIGGER:
|
case OCLASS_TRIGGER:
|
||||||
appendStringInfo(&buffer, "trigger");
|
appendStringInfoString(&buffer, "trigger");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_SCHEMA:
|
case OCLASS_SCHEMA:
|
||||||
appendStringInfo(&buffer, "schema");
|
appendStringInfoString(&buffer, "schema");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_TSPARSER:
|
case OCLASS_TSPARSER:
|
||||||
appendStringInfo(&buffer, "text search parser");
|
appendStringInfoString(&buffer, "text search parser");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_TSDICT:
|
case OCLASS_TSDICT:
|
||||||
appendStringInfo(&buffer, "text search dictionary");
|
appendStringInfoString(&buffer, "text search dictionary");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_TSTEMPLATE:
|
case OCLASS_TSTEMPLATE:
|
||||||
appendStringInfo(&buffer, "text search template");
|
appendStringInfoString(&buffer, "text search template");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_TSCONFIG:
|
case OCLASS_TSCONFIG:
|
||||||
appendStringInfo(&buffer, "text search configuration");
|
appendStringInfoString(&buffer, "text search configuration");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_ROLE:
|
case OCLASS_ROLE:
|
||||||
appendStringInfo(&buffer, "role");
|
appendStringInfoString(&buffer, "role");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_DATABASE:
|
case OCLASS_DATABASE:
|
||||||
appendStringInfo(&buffer, "database");
|
appendStringInfoString(&buffer, "database");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_TBLSPACE:
|
case OCLASS_TBLSPACE:
|
||||||
appendStringInfo(&buffer, "tablespace");
|
appendStringInfoString(&buffer, "tablespace");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_FDW:
|
case OCLASS_FDW:
|
||||||
appendStringInfo(&buffer, "foreign-data wrapper");
|
appendStringInfoString(&buffer, "foreign-data wrapper");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_FOREIGN_SERVER:
|
case OCLASS_FOREIGN_SERVER:
|
||||||
appendStringInfo(&buffer, "server");
|
appendStringInfoString(&buffer, "server");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_USER_MAPPING:
|
case OCLASS_USER_MAPPING:
|
||||||
appendStringInfo(&buffer, "user mapping");
|
appendStringInfoString(&buffer, "user mapping");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_DEFACL:
|
case OCLASS_DEFACL:
|
||||||
appendStringInfo(&buffer, "default acl");
|
appendStringInfoString(&buffer, "default acl");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_EXTENSION:
|
case OCLASS_EXTENSION:
|
||||||
appendStringInfo(&buffer, "extension");
|
appendStringInfoString(&buffer, "extension");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_EVENT_TRIGGER:
|
case OCLASS_EVENT_TRIGGER:
|
||||||
appendStringInfo(&buffer, "event trigger");
|
appendStringInfoString(&buffer, "event trigger");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -2580,37 +2580,37 @@ getRelationTypeDescription(StringInfo buffer, Oid relid, int32 objectSubId)
|
|||||||
switch (relForm->relkind)
|
switch (relForm->relkind)
|
||||||
{
|
{
|
||||||
case RELKIND_RELATION:
|
case RELKIND_RELATION:
|
||||||
appendStringInfo(buffer, "table");
|
appendStringInfoString(buffer, "table");
|
||||||
break;
|
break;
|
||||||
case RELKIND_INDEX:
|
case RELKIND_INDEX:
|
||||||
appendStringInfo(buffer, "index");
|
appendStringInfoString(buffer, "index");
|
||||||
break;
|
break;
|
||||||
case RELKIND_SEQUENCE:
|
case RELKIND_SEQUENCE:
|
||||||
appendStringInfo(buffer, "sequence");
|
appendStringInfoString(buffer, "sequence");
|
||||||
break;
|
break;
|
||||||
case RELKIND_TOASTVALUE:
|
case RELKIND_TOASTVALUE:
|
||||||
appendStringInfo(buffer, "toast table");
|
appendStringInfoString(buffer, "toast table");
|
||||||
break;
|
break;
|
||||||
case RELKIND_VIEW:
|
case RELKIND_VIEW:
|
||||||
appendStringInfo(buffer, "view");
|
appendStringInfoString(buffer, "view");
|
||||||
break;
|
break;
|
||||||
case RELKIND_MATVIEW:
|
case RELKIND_MATVIEW:
|
||||||
appendStringInfo(buffer, "materialized view");
|
appendStringInfoString(buffer, "materialized view");
|
||||||
break;
|
break;
|
||||||
case RELKIND_COMPOSITE_TYPE:
|
case RELKIND_COMPOSITE_TYPE:
|
||||||
appendStringInfo(buffer, "composite type");
|
appendStringInfoString(buffer, "composite type");
|
||||||
break;
|
break;
|
||||||
case RELKIND_FOREIGN_TABLE:
|
case RELKIND_FOREIGN_TABLE:
|
||||||
appendStringInfo(buffer, "foreign table");
|
appendStringInfoString(buffer, "foreign table");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
/* shouldn't get here */
|
/* shouldn't get here */
|
||||||
appendStringInfo(buffer, "relation");
|
appendStringInfoString(buffer, "relation");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (objectSubId != 0)
|
if (objectSubId != 0)
|
||||||
appendStringInfo(buffer, " column");
|
appendStringInfoString(buffer, " column");
|
||||||
|
|
||||||
ReleaseSysCache(relTup);
|
ReleaseSysCache(relTup);
|
||||||
}
|
}
|
||||||
@ -2658,9 +2658,9 @@ getProcedureTypeDescription(StringInfo buffer, Oid procid)
|
|||||||
procForm = (Form_pg_proc) GETSTRUCT(procTup);
|
procForm = (Form_pg_proc) GETSTRUCT(procTup);
|
||||||
|
|
||||||
if (procForm->proisagg)
|
if (procForm->proisagg)
|
||||||
appendStringInfo(buffer, "aggregate");
|
appendStringInfoString(buffer, "aggregate");
|
||||||
else
|
else
|
||||||
appendStringInfo(buffer, "function");
|
appendStringInfoString(buffer, "function");
|
||||||
|
|
||||||
ReleaseSysCache(procTup);
|
ReleaseSysCache(procTup);
|
||||||
}
|
}
|
||||||
@ -2693,12 +2693,12 @@ getObjectIdentity(const ObjectAddress *object)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_PROC:
|
case OCLASS_PROC:
|
||||||
appendStringInfo(&buffer, "%s",
|
appendStringInfoString(&buffer,
|
||||||
format_procedure_qualified(object->objectId));
|
format_procedure_qualified(object->objectId));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_TYPE:
|
case OCLASS_TYPE:
|
||||||
appendStringInfo(&buffer, "%s",
|
appendStringInfoString(&buffer,
|
||||||
format_type_be_qualified(object->objectId));
|
format_type_be_qualified(object->objectId));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2792,7 +2792,7 @@ getObjectIdentity(const ObjectAddress *object)
|
|||||||
elog(ERROR, "cache lookup failed for conversion %u",
|
elog(ERROR, "cache lookup failed for conversion %u",
|
||||||
object->objectId);
|
object->objectId);
|
||||||
conForm = (Form_pg_conversion) GETSTRUCT(conTup);
|
conForm = (Form_pg_conversion) GETSTRUCT(conTup);
|
||||||
appendStringInfo(&buffer, "%s",
|
appendStringInfoString(&buffer,
|
||||||
quote_identifier(NameStr(conForm->conname)));
|
quote_identifier(NameStr(conForm->conname)));
|
||||||
ReleaseSysCache(conTup);
|
ReleaseSysCache(conTup);
|
||||||
break;
|
break;
|
||||||
@ -2849,7 +2849,7 @@ getObjectIdentity(const ObjectAddress *object)
|
|||||||
elog(ERROR, "cache lookup failed for language %u",
|
elog(ERROR, "cache lookup failed for language %u",
|
||||||
object->objectId);
|
object->objectId);
|
||||||
langForm = (Form_pg_language) GETSTRUCT(langTup);
|
langForm = (Form_pg_language) GETSTRUCT(langTup);
|
||||||
appendStringInfo(&buffer, "%s",
|
appendStringInfoString(&buffer,
|
||||||
quote_identifier(NameStr(langForm->lanname)));
|
quote_identifier(NameStr(langForm->lanname)));
|
||||||
ReleaseSysCache(langTup);
|
ReleaseSysCache(langTup);
|
||||||
break;
|
break;
|
||||||
@ -2860,7 +2860,7 @@ getObjectIdentity(const ObjectAddress *object)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case OCLASS_OPERATOR:
|
case OCLASS_OPERATOR:
|
||||||
appendStringInfo(&buffer, "%s",
|
appendStringInfoString(&buffer,
|
||||||
format_operator_qualified(object->objectId));
|
format_operator_qualified(object->objectId));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -2887,8 +2887,7 @@ getObjectIdentity(const ObjectAddress *object)
|
|||||||
opcForm->opcmethod);
|
opcForm->opcmethod);
|
||||||
amForm = (Form_pg_am) GETSTRUCT(amTup);
|
amForm = (Form_pg_am) GETSTRUCT(amTup);
|
||||||
|
|
||||||
appendStringInfo(&buffer,
|
appendStringInfoString(&buffer,
|
||||||
"%s",
|
|
||||||
quote_qualified_identifier(schema,
|
quote_qualified_identifier(schema,
|
||||||
NameStr(opcForm->opcname)));
|
NameStr(opcForm->opcname)));
|
||||||
appendStringInfo(&buffer, " for %s",
|
appendStringInfo(&buffer, " for %s",
|
||||||
@ -3047,7 +3046,7 @@ getObjectIdentity(const ObjectAddress *object)
|
|||||||
if (!nspname)
|
if (!nspname)
|
||||||
elog(ERROR, "cache lookup failed for namespace %u",
|
elog(ERROR, "cache lookup failed for namespace %u",
|
||||||
object->objectId);
|
object->objectId);
|
||||||
appendStringInfo(&buffer, "%s",
|
appendStringInfoString(&buffer,
|
||||||
quote_identifier(nspname));
|
quote_identifier(nspname));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3063,7 +3062,7 @@ getObjectIdentity(const ObjectAddress *object)
|
|||||||
elog(ERROR, "cache lookup failed for text search parser %u",
|
elog(ERROR, "cache lookup failed for text search parser %u",
|
||||||
object->objectId);
|
object->objectId);
|
||||||
formParser = (Form_pg_ts_parser) GETSTRUCT(tup);
|
formParser = (Form_pg_ts_parser) GETSTRUCT(tup);
|
||||||
appendStringInfo(&buffer, "%s",
|
appendStringInfoString(&buffer,
|
||||||
quote_identifier(NameStr(formParser->prsname)));
|
quote_identifier(NameStr(formParser->prsname)));
|
||||||
ReleaseSysCache(tup);
|
ReleaseSysCache(tup);
|
||||||
break;
|
break;
|
||||||
@ -3080,7 +3079,7 @@ getObjectIdentity(const ObjectAddress *object)
|
|||||||
elog(ERROR, "cache lookup failed for text search dictionary %u",
|
elog(ERROR, "cache lookup failed for text search dictionary %u",
|
||||||
object->objectId);
|
object->objectId);
|
||||||
formDict = (Form_pg_ts_dict) GETSTRUCT(tup);
|
formDict = (Form_pg_ts_dict) GETSTRUCT(tup);
|
||||||
appendStringInfo(&buffer, "%s",
|
appendStringInfoString(&buffer,
|
||||||
quote_identifier(NameStr(formDict->dictname)));
|
quote_identifier(NameStr(formDict->dictname)));
|
||||||
ReleaseSysCache(tup);
|
ReleaseSysCache(tup);
|
||||||
break;
|
break;
|
||||||
@ -3097,7 +3096,7 @@ getObjectIdentity(const ObjectAddress *object)
|
|||||||
elog(ERROR, "cache lookup failed for text search template %u",
|
elog(ERROR, "cache lookup failed for text search template %u",
|
||||||
object->objectId);
|
object->objectId);
|
||||||
formTmpl = (Form_pg_ts_template) GETSTRUCT(tup);
|
formTmpl = (Form_pg_ts_template) GETSTRUCT(tup);
|
||||||
appendStringInfo(&buffer, "%s",
|
appendStringInfoString(&buffer,
|
||||||
quote_identifier(NameStr(formTmpl->tmplname)));
|
quote_identifier(NameStr(formTmpl->tmplname)));
|
||||||
ReleaseSysCache(tup);
|
ReleaseSysCache(tup);
|
||||||
break;
|
break;
|
||||||
@ -3114,7 +3113,7 @@ getObjectIdentity(const ObjectAddress *object)
|
|||||||
elog(ERROR, "cache lookup failed for text search configuration %u",
|
elog(ERROR, "cache lookup failed for text search configuration %u",
|
||||||
object->objectId);
|
object->objectId);
|
||||||
formCfg = (Form_pg_ts_config) GETSTRUCT(tup);
|
formCfg = (Form_pg_ts_config) GETSTRUCT(tup);
|
||||||
appendStringInfo(&buffer, "%s",
|
appendStringInfoString(&buffer,
|
||||||
quote_identifier(NameStr(formCfg->cfgname)));
|
quote_identifier(NameStr(formCfg->cfgname)));
|
||||||
ReleaseSysCache(tup);
|
ReleaseSysCache(tup);
|
||||||
break;
|
break;
|
||||||
@ -3125,7 +3124,7 @@ getObjectIdentity(const ObjectAddress *object)
|
|||||||
char *username;
|
char *username;
|
||||||
|
|
||||||
username = GetUserNameFromId(object->objectId);
|
username = GetUserNameFromId(object->objectId);
|
||||||
appendStringInfo(&buffer, "%s",
|
appendStringInfoString(&buffer,
|
||||||
quote_identifier(username));
|
quote_identifier(username));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3138,7 +3137,7 @@ getObjectIdentity(const ObjectAddress *object)
|
|||||||
if (!datname)
|
if (!datname)
|
||||||
elog(ERROR, "cache lookup failed for database %u",
|
elog(ERROR, "cache lookup failed for database %u",
|
||||||
object->objectId);
|
object->objectId);
|
||||||
appendStringInfo(&buffer, "%s",
|
appendStringInfoString(&buffer,
|
||||||
quote_identifier(datname));
|
quote_identifier(datname));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3151,7 +3150,7 @@ getObjectIdentity(const ObjectAddress *object)
|
|||||||
if (!tblspace)
|
if (!tblspace)
|
||||||
elog(ERROR, "cache lookup failed for tablespace %u",
|
elog(ERROR, "cache lookup failed for tablespace %u",
|
||||||
object->objectId);
|
object->objectId);
|
||||||
appendStringInfo(&buffer, "%s",
|
appendStringInfoString(&buffer,
|
||||||
quote_identifier(tblspace));
|
quote_identifier(tblspace));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3161,8 +3160,7 @@ getObjectIdentity(const ObjectAddress *object)
|
|||||||
ForeignDataWrapper *fdw;
|
ForeignDataWrapper *fdw;
|
||||||
|
|
||||||
fdw = GetForeignDataWrapper(object->objectId);
|
fdw = GetForeignDataWrapper(object->objectId);
|
||||||
appendStringInfo(&buffer, "%s",
|
appendStringInfoString(&buffer, quote_identifier(fdw->fdwname));
|
||||||
quote_identifier(fdw->fdwname));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3171,7 +3169,7 @@ getObjectIdentity(const ObjectAddress *object)
|
|||||||
ForeignServer *srv;
|
ForeignServer *srv;
|
||||||
|
|
||||||
srv = GetForeignServer(object->objectId);
|
srv = GetForeignServer(object->objectId);
|
||||||
appendStringInfo(&buffer, "%s",
|
appendStringInfoString(&buffer,
|
||||||
quote_identifier(srv->servername));
|
quote_identifier(srv->servername));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -3197,7 +3195,7 @@ getObjectIdentity(const ObjectAddress *object)
|
|||||||
else
|
else
|
||||||
usename = "public";
|
usename = "public";
|
||||||
|
|
||||||
appendStringInfo(&buffer, "%s", usename);
|
appendStringInfoString(&buffer, usename);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3275,8 +3273,7 @@ getObjectIdentity(const ObjectAddress *object)
|
|||||||
if (!extname)
|
if (!extname)
|
||||||
elog(ERROR, "cache lookup failed for extension %u",
|
elog(ERROR, "cache lookup failed for extension %u",
|
||||||
object->objectId);
|
object->objectId);
|
||||||
appendStringInfo(&buffer, "%s",
|
appendStringInfoString(&buffer, quote_identifier(extname));
|
||||||
quote_identifier(extname));
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3291,7 +3288,7 @@ getObjectIdentity(const ObjectAddress *object)
|
|||||||
elog(ERROR, "cache lookup failed for event trigger %u",
|
elog(ERROR, "cache lookup failed for event trigger %u",
|
||||||
object->objectId);
|
object->objectId);
|
||||||
trigForm = (Form_pg_event_trigger) GETSTRUCT(tup);
|
trigForm = (Form_pg_event_trigger) GETSTRUCT(tup);
|
||||||
appendStringInfo(&buffer, "%s",
|
appendStringInfoString(&buffer,
|
||||||
quote_identifier(NameStr(trigForm->evtname)));
|
quote_identifier(NameStr(trigForm->evtname)));
|
||||||
ReleaseSysCache(tup);
|
ReleaseSysCache(tup);
|
||||||
break;
|
break;
|
||||||
@ -3356,7 +3353,7 @@ getRelationIdentity(StringInfo buffer, Oid relid)
|
|||||||
relForm = (Form_pg_class) GETSTRUCT(relTup);
|
relForm = (Form_pg_class) GETSTRUCT(relTup);
|
||||||
|
|
||||||
schema = get_namespace_name(relForm->relnamespace);
|
schema = get_namespace_name(relForm->relnamespace);
|
||||||
appendStringInfo(buffer, "%s",
|
appendStringInfoString(buffer,
|
||||||
quote_qualified_identifier(schema,
|
quote_qualified_identifier(schema,
|
||||||
NameStr(relForm->relname)));
|
NameStr(relForm->relname)));
|
||||||
|
|
||||||
|
@ -1087,7 +1087,7 @@ ExplainNode(PlanState *planstate, List *ancestors,
|
|||||||
if (((Join *) plan)->jointype != JOIN_INNER)
|
if (((Join *) plan)->jointype != JOIN_INNER)
|
||||||
appendStringInfo(es->str, " %s Join", jointype);
|
appendStringInfo(es->str, " %s Join", jointype);
|
||||||
else if (!IsA(plan, NestLoop))
|
else if (!IsA(plan, NestLoop))
|
||||||
appendStringInfo(es->str, " Join");
|
appendStringInfoString(es->str, " Join");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
ExplainPropertyText("Join Type", jointype, es);
|
ExplainPropertyText("Join Type", jointype, es);
|
||||||
@ -1182,7 +1182,7 @@ ExplainNode(PlanState *planstate, List *ancestors,
|
|||||||
{
|
{
|
||||||
|
|
||||||
if (es->format == EXPLAIN_FORMAT_TEXT)
|
if (es->format == EXPLAIN_FORMAT_TEXT)
|
||||||
appendStringInfo(es->str, " (never executed)");
|
appendStringInfoString(es->str, " (never executed)");
|
||||||
else if (planstate->instrument->need_timer)
|
else if (planstate->instrument->need_timer)
|
||||||
{
|
{
|
||||||
ExplainPropertyFloat("Actual Startup Time", 0.0, 3, es);
|
ExplainPropertyFloat("Actual Startup Time", 0.0, 3, es);
|
||||||
|
@ -1523,7 +1523,7 @@ serialize_deflist(List *deflist)
|
|||||||
}
|
}
|
||||||
appendStringInfoChar(&buf, '\'');
|
appendStringInfoChar(&buf, '\'');
|
||||||
if (lnext(l) != NULL)
|
if (lnext(l) != NULL)
|
||||||
appendStringInfo(&buf, ", ");
|
appendStringInfoString(&buf, ", ");
|
||||||
}
|
}
|
||||||
|
|
||||||
result = cstring_to_text_with_len(buf.data, buf.len);
|
result = cstring_to_text_with_len(buf.data, buf.len);
|
||||||
|
@ -111,7 +111,7 @@ _outToken(StringInfo str, const char *s)
|
|||||||
{
|
{
|
||||||
if (s == NULL || *s == '\0')
|
if (s == NULL || *s == '\0')
|
||||||
{
|
{
|
||||||
appendStringInfo(str, "<>");
|
appendStringInfoString(str, "<>");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -214,19 +214,19 @@ _outDatum(StringInfo str, Datum value, int typlen, bool typbyval)
|
|||||||
appendStringInfo(str, "%u [ ", (unsigned int) length);
|
appendStringInfo(str, "%u [ ", (unsigned int) length);
|
||||||
for (i = 0; i < (Size) sizeof(Datum); i++)
|
for (i = 0; i < (Size) sizeof(Datum); i++)
|
||||||
appendStringInfo(str, "%d ", (int) (s[i]));
|
appendStringInfo(str, "%d ", (int) (s[i]));
|
||||||
appendStringInfo(str, "]");
|
appendStringInfoChar(str, ']');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
s = (char *) DatumGetPointer(value);
|
s = (char *) DatumGetPointer(value);
|
||||||
if (!PointerIsValid(s))
|
if (!PointerIsValid(s))
|
||||||
appendStringInfo(str, "0 [ ]");
|
appendStringInfoString(str, "0 [ ]");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
appendStringInfo(str, "%u [ ", (unsigned int) length);
|
appendStringInfo(str, "%u [ ", (unsigned int) length);
|
||||||
for (i = 0; i < length; i++)
|
for (i = 0; i < length; i++)
|
||||||
appendStringInfo(str, "%d ", (int) (s[i]));
|
appendStringInfo(str, "%d ", (int) (s[i]));
|
||||||
appendStringInfo(str, "]");
|
appendStringInfoChar(str, ']');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -362,19 +362,19 @@ _outMergeAppend(StringInfo str, const MergeAppend *node)
|
|||||||
|
|
||||||
WRITE_INT_FIELD(numCols);
|
WRITE_INT_FIELD(numCols);
|
||||||
|
|
||||||
appendStringInfo(str, " :sortColIdx");
|
appendStringInfoString(str, " :sortColIdx");
|
||||||
for (i = 0; i < node->numCols; i++)
|
for (i = 0; i < node->numCols; i++)
|
||||||
appendStringInfo(str, " %d", node->sortColIdx[i]);
|
appendStringInfo(str, " %d", node->sortColIdx[i]);
|
||||||
|
|
||||||
appendStringInfo(str, " :sortOperators");
|
appendStringInfoString(str, " :sortOperators");
|
||||||
for (i = 0; i < node->numCols; i++)
|
for (i = 0; i < node->numCols; i++)
|
||||||
appendStringInfo(str, " %u", node->sortOperators[i]);
|
appendStringInfo(str, " %u", node->sortOperators[i]);
|
||||||
|
|
||||||
appendStringInfo(str, " :collations");
|
appendStringInfoString(str, " :collations");
|
||||||
for (i = 0; i < node->numCols; i++)
|
for (i = 0; i < node->numCols; i++)
|
||||||
appendStringInfo(str, " %u", node->collations[i]);
|
appendStringInfo(str, " %u", node->collations[i]);
|
||||||
|
|
||||||
appendStringInfo(str, " :nullsFirst");
|
appendStringInfoString(str, " :nullsFirst");
|
||||||
for (i = 0; i < node->numCols; i++)
|
for (i = 0; i < node->numCols; i++)
|
||||||
appendStringInfo(str, " %s", booltostr(node->nullsFirst[i]));
|
appendStringInfo(str, " %s", booltostr(node->nullsFirst[i]));
|
||||||
}
|
}
|
||||||
@ -391,11 +391,11 @@ _outRecursiveUnion(StringInfo str, const RecursiveUnion *node)
|
|||||||
WRITE_INT_FIELD(wtParam);
|
WRITE_INT_FIELD(wtParam);
|
||||||
WRITE_INT_FIELD(numCols);
|
WRITE_INT_FIELD(numCols);
|
||||||
|
|
||||||
appendStringInfo(str, " :dupColIdx");
|
appendStringInfoString(str, " :dupColIdx");
|
||||||
for (i = 0; i < node->numCols; i++)
|
for (i = 0; i < node->numCols; i++)
|
||||||
appendStringInfo(str, " %d", node->dupColIdx[i]);
|
appendStringInfo(str, " %d", node->dupColIdx[i]);
|
||||||
|
|
||||||
appendStringInfo(str, " :dupOperators");
|
appendStringInfoString(str, " :dupOperators");
|
||||||
for (i = 0; i < node->numCols; i++)
|
for (i = 0; i < node->numCols; i++)
|
||||||
appendStringInfo(str, " %u", node->dupOperators[i]);
|
appendStringInfo(str, " %u", node->dupOperators[i]);
|
||||||
|
|
||||||
@ -599,19 +599,19 @@ _outMergeJoin(StringInfo str, const MergeJoin *node)
|
|||||||
|
|
||||||
numCols = list_length(node->mergeclauses);
|
numCols = list_length(node->mergeclauses);
|
||||||
|
|
||||||
appendStringInfo(str, " :mergeFamilies");
|
appendStringInfoString(str, " :mergeFamilies");
|
||||||
for (i = 0; i < numCols; i++)
|
for (i = 0; i < numCols; i++)
|
||||||
appendStringInfo(str, " %u", node->mergeFamilies[i]);
|
appendStringInfo(str, " %u", node->mergeFamilies[i]);
|
||||||
|
|
||||||
appendStringInfo(str, " :mergeCollations");
|
appendStringInfoString(str, " :mergeCollations");
|
||||||
for (i = 0; i < numCols; i++)
|
for (i = 0; i < numCols; i++)
|
||||||
appendStringInfo(str, " %u", node->mergeCollations[i]);
|
appendStringInfo(str, " %u", node->mergeCollations[i]);
|
||||||
|
|
||||||
appendStringInfo(str, " :mergeStrategies");
|
appendStringInfoString(str, " :mergeStrategies");
|
||||||
for (i = 0; i < numCols; i++)
|
for (i = 0; i < numCols; i++)
|
||||||
appendStringInfo(str, " %d", node->mergeStrategies[i]);
|
appendStringInfo(str, " %d", node->mergeStrategies[i]);
|
||||||
|
|
||||||
appendStringInfo(str, " :mergeNullsFirst");
|
appendStringInfoString(str, " :mergeNullsFirst");
|
||||||
for (i = 0; i < numCols; i++)
|
for (i = 0; i < numCols; i++)
|
||||||
appendStringInfo(str, " %d", (int) node->mergeNullsFirst[i]);
|
appendStringInfo(str, " %d", (int) node->mergeNullsFirst[i]);
|
||||||
}
|
}
|
||||||
@ -638,11 +638,11 @@ _outAgg(StringInfo str, const Agg *node)
|
|||||||
WRITE_ENUM_FIELD(aggstrategy, AggStrategy);
|
WRITE_ENUM_FIELD(aggstrategy, AggStrategy);
|
||||||
WRITE_INT_FIELD(numCols);
|
WRITE_INT_FIELD(numCols);
|
||||||
|
|
||||||
appendStringInfo(str, " :grpColIdx");
|
appendStringInfoString(str, " :grpColIdx");
|
||||||
for (i = 0; i < node->numCols; i++)
|
for (i = 0; i < node->numCols; i++)
|
||||||
appendStringInfo(str, " %d", node->grpColIdx[i]);
|
appendStringInfo(str, " %d", node->grpColIdx[i]);
|
||||||
|
|
||||||
appendStringInfo(str, " :grpOperators");
|
appendStringInfoString(str, " :grpOperators");
|
||||||
for (i = 0; i < node->numCols; i++)
|
for (i = 0; i < node->numCols; i++)
|
||||||
appendStringInfo(str, " %u", node->grpOperators[i]);
|
appendStringInfo(str, " %u", node->grpOperators[i]);
|
||||||
|
|
||||||
@ -661,21 +661,21 @@ _outWindowAgg(StringInfo str, const WindowAgg *node)
|
|||||||
WRITE_UINT_FIELD(winref);
|
WRITE_UINT_FIELD(winref);
|
||||||
WRITE_INT_FIELD(partNumCols);
|
WRITE_INT_FIELD(partNumCols);
|
||||||
|
|
||||||
appendStringInfo(str, " :partColIdx");
|
appendStringInfoString(str, " :partColIdx");
|
||||||
for (i = 0; i < node->partNumCols; i++)
|
for (i = 0; i < node->partNumCols; i++)
|
||||||
appendStringInfo(str, " %d", node->partColIdx[i]);
|
appendStringInfo(str, " %d", node->partColIdx[i]);
|
||||||
|
|
||||||
appendStringInfo(str, " :partOperations");
|
appendStringInfoString(str, " :partOperations");
|
||||||
for (i = 0; i < node->partNumCols; i++)
|
for (i = 0; i < node->partNumCols; i++)
|
||||||
appendStringInfo(str, " %u", node->partOperators[i]);
|
appendStringInfo(str, " %u", node->partOperators[i]);
|
||||||
|
|
||||||
WRITE_INT_FIELD(ordNumCols);
|
WRITE_INT_FIELD(ordNumCols);
|
||||||
|
|
||||||
appendStringInfo(str, " :ordColIdx");
|
appendStringInfoString(str, " :ordColIdx");
|
||||||
for (i = 0; i < node->ordNumCols; i++)
|
for (i = 0; i < node->ordNumCols; i++)
|
||||||
appendStringInfo(str, " %d", node->ordColIdx[i]);
|
appendStringInfo(str, " %d", node->ordColIdx[i]);
|
||||||
|
|
||||||
appendStringInfo(str, " :ordOperations");
|
appendStringInfoString(str, " :ordOperations");
|
||||||
for (i = 0; i < node->ordNumCols; i++)
|
for (i = 0; i < node->ordNumCols; i++)
|
||||||
appendStringInfo(str, " %u", node->ordOperators[i]);
|
appendStringInfo(str, " %u", node->ordOperators[i]);
|
||||||
|
|
||||||
@ -695,11 +695,11 @@ _outGroup(StringInfo str, const Group *node)
|
|||||||
|
|
||||||
WRITE_INT_FIELD(numCols);
|
WRITE_INT_FIELD(numCols);
|
||||||
|
|
||||||
appendStringInfo(str, " :grpColIdx");
|
appendStringInfoString(str, " :grpColIdx");
|
||||||
for (i = 0; i < node->numCols; i++)
|
for (i = 0; i < node->numCols; i++)
|
||||||
appendStringInfo(str, " %d", node->grpColIdx[i]);
|
appendStringInfo(str, " %d", node->grpColIdx[i]);
|
||||||
|
|
||||||
appendStringInfo(str, " :grpOperators");
|
appendStringInfoString(str, " :grpOperators");
|
||||||
for (i = 0; i < node->numCols; i++)
|
for (i = 0; i < node->numCols; i++)
|
||||||
appendStringInfo(str, " %u", node->grpOperators[i]);
|
appendStringInfo(str, " %u", node->grpOperators[i]);
|
||||||
}
|
}
|
||||||
@ -723,19 +723,19 @@ _outSort(StringInfo str, const Sort *node)
|
|||||||
|
|
||||||
WRITE_INT_FIELD(numCols);
|
WRITE_INT_FIELD(numCols);
|
||||||
|
|
||||||
appendStringInfo(str, " :sortColIdx");
|
appendStringInfoString(str, " :sortColIdx");
|
||||||
for (i = 0; i < node->numCols; i++)
|
for (i = 0; i < node->numCols; i++)
|
||||||
appendStringInfo(str, " %d", node->sortColIdx[i]);
|
appendStringInfo(str, " %d", node->sortColIdx[i]);
|
||||||
|
|
||||||
appendStringInfo(str, " :sortOperators");
|
appendStringInfoString(str, " :sortOperators");
|
||||||
for (i = 0; i < node->numCols; i++)
|
for (i = 0; i < node->numCols; i++)
|
||||||
appendStringInfo(str, " %u", node->sortOperators[i]);
|
appendStringInfo(str, " %u", node->sortOperators[i]);
|
||||||
|
|
||||||
appendStringInfo(str, " :collations");
|
appendStringInfoString(str, " :collations");
|
||||||
for (i = 0; i < node->numCols; i++)
|
for (i = 0; i < node->numCols; i++)
|
||||||
appendStringInfo(str, " %u", node->collations[i]);
|
appendStringInfo(str, " %u", node->collations[i]);
|
||||||
|
|
||||||
appendStringInfo(str, " :nullsFirst");
|
appendStringInfoString(str, " :nullsFirst");
|
||||||
for (i = 0; i < node->numCols; i++)
|
for (i = 0; i < node->numCols; i++)
|
||||||
appendStringInfo(str, " %s", booltostr(node->nullsFirst[i]));
|
appendStringInfo(str, " %s", booltostr(node->nullsFirst[i]));
|
||||||
}
|
}
|
||||||
@ -751,11 +751,11 @@ _outUnique(StringInfo str, const Unique *node)
|
|||||||
|
|
||||||
WRITE_INT_FIELD(numCols);
|
WRITE_INT_FIELD(numCols);
|
||||||
|
|
||||||
appendStringInfo(str, " :uniqColIdx");
|
appendStringInfoString(str, " :uniqColIdx");
|
||||||
for (i = 0; i < node->numCols; i++)
|
for (i = 0; i < node->numCols; i++)
|
||||||
appendStringInfo(str, " %d", node->uniqColIdx[i]);
|
appendStringInfo(str, " %d", node->uniqColIdx[i]);
|
||||||
|
|
||||||
appendStringInfo(str, " :uniqOperators");
|
appendStringInfoString(str, " :uniqOperators");
|
||||||
for (i = 0; i < node->numCols; i++)
|
for (i = 0; i < node->numCols; i++)
|
||||||
appendStringInfo(str, " %u", node->uniqOperators[i]);
|
appendStringInfo(str, " %u", node->uniqOperators[i]);
|
||||||
}
|
}
|
||||||
@ -787,11 +787,11 @@ _outSetOp(StringInfo str, const SetOp *node)
|
|||||||
WRITE_ENUM_FIELD(strategy, SetOpStrategy);
|
WRITE_ENUM_FIELD(strategy, SetOpStrategy);
|
||||||
WRITE_INT_FIELD(numCols);
|
WRITE_INT_FIELD(numCols);
|
||||||
|
|
||||||
appendStringInfo(str, " :dupColIdx");
|
appendStringInfoString(str, " :dupColIdx");
|
||||||
for (i = 0; i < node->numCols; i++)
|
for (i = 0; i < node->numCols; i++)
|
||||||
appendStringInfo(str, " %d", node->dupColIdx[i]);
|
appendStringInfo(str, " %d", node->dupColIdx[i]);
|
||||||
|
|
||||||
appendStringInfo(str, " :dupOperators");
|
appendStringInfoString(str, " :dupOperators");
|
||||||
for (i = 0; i < node->numCols; i++)
|
for (i = 0; i < node->numCols; i++)
|
||||||
appendStringInfo(str, " %u", node->dupOperators[i]);
|
appendStringInfo(str, " %u", node->dupOperators[i]);
|
||||||
|
|
||||||
@ -928,9 +928,9 @@ _outConst(StringInfo str, const Const *node)
|
|||||||
WRITE_BOOL_FIELD(constisnull);
|
WRITE_BOOL_FIELD(constisnull);
|
||||||
WRITE_LOCATION_FIELD(location);
|
WRITE_LOCATION_FIELD(location);
|
||||||
|
|
||||||
appendStringInfo(str, " :constvalue ");
|
appendStringInfoString(str, " :constvalue ");
|
||||||
if (node->constisnull)
|
if (node->constisnull)
|
||||||
appendStringInfo(str, "<>");
|
appendStringInfoString(str, "<>");
|
||||||
else
|
else
|
||||||
_outDatum(str, node->constvalue, node->constlen, node->constbyval);
|
_outDatum(str, node->constvalue, node->constlen, node->constbyval);
|
||||||
}
|
}
|
||||||
@ -1104,7 +1104,7 @@ _outBoolExpr(StringInfo str, const BoolExpr *node)
|
|||||||
opstr = "not";
|
opstr = "not";
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
appendStringInfo(str, " :boolop ");
|
appendStringInfoString(str, " :boolop ");
|
||||||
_outToken(str, opstr);
|
_outToken(str, opstr);
|
||||||
|
|
||||||
WRITE_NODE_FIELD(args);
|
WRITE_NODE_FIELD(args);
|
||||||
@ -1477,9 +1477,9 @@ static void
|
|||||||
_outPathInfo(StringInfo str, const Path *node)
|
_outPathInfo(StringInfo str, const Path *node)
|
||||||
{
|
{
|
||||||
WRITE_ENUM_FIELD(pathtype, NodeTag);
|
WRITE_ENUM_FIELD(pathtype, NodeTag);
|
||||||
appendStringInfo(str, " :parent_relids ");
|
appendStringInfoString(str, " :parent_relids ");
|
||||||
_outBitmapset(str, node->parent->relids);
|
_outBitmapset(str, node->parent->relids);
|
||||||
appendStringInfo(str, " :required_outer ");
|
appendStringInfoString(str, " :required_outer ");
|
||||||
if (node->param_info)
|
if (node->param_info)
|
||||||
_outBitmapset(str, node->param_info->ppi_req_outer);
|
_outBitmapset(str, node->param_info->ppi_req_outer);
|
||||||
else
|
else
|
||||||
@ -2232,12 +2232,12 @@ _outQuery(StringInfo str, const Query *node)
|
|||||||
WRITE_NODE_FIELD(utilityStmt);
|
WRITE_NODE_FIELD(utilityStmt);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
appendStringInfo(str, " :utilityStmt ?");
|
appendStringInfoString(str, " :utilityStmt ?");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
appendStringInfo(str, " :utilityStmt <>");
|
appendStringInfoString(str, " :utilityStmt <>");
|
||||||
|
|
||||||
WRITE_INT_FIELD(resultRelation);
|
WRITE_INT_FIELD(resultRelation);
|
||||||
WRITE_BOOL_FIELD(hasAggs);
|
WRITE_BOOL_FIELD(hasAggs);
|
||||||
@ -2421,46 +2421,46 @@ _outAExpr(StringInfo str, const A_Expr *node)
|
|||||||
switch (node->kind)
|
switch (node->kind)
|
||||||
{
|
{
|
||||||
case AEXPR_OP:
|
case AEXPR_OP:
|
||||||
appendStringInfo(str, " ");
|
appendStringInfoChar(str, ' ');
|
||||||
WRITE_NODE_FIELD(name);
|
WRITE_NODE_FIELD(name);
|
||||||
break;
|
break;
|
||||||
case AEXPR_AND:
|
case AEXPR_AND:
|
||||||
appendStringInfo(str, " AND");
|
appendStringInfoString(str, " AND");
|
||||||
break;
|
break;
|
||||||
case AEXPR_OR:
|
case AEXPR_OR:
|
||||||
appendStringInfo(str, " OR");
|
appendStringInfoString(str, " OR");
|
||||||
break;
|
break;
|
||||||
case AEXPR_NOT:
|
case AEXPR_NOT:
|
||||||
appendStringInfo(str, " NOT");
|
appendStringInfoString(str, " NOT");
|
||||||
break;
|
break;
|
||||||
case AEXPR_OP_ANY:
|
case AEXPR_OP_ANY:
|
||||||
appendStringInfo(str, " ");
|
appendStringInfoChar(str, ' ');
|
||||||
WRITE_NODE_FIELD(name);
|
WRITE_NODE_FIELD(name);
|
||||||
appendStringInfo(str, " ANY ");
|
appendStringInfoString(str, " ANY ");
|
||||||
break;
|
break;
|
||||||
case AEXPR_OP_ALL:
|
case AEXPR_OP_ALL:
|
||||||
appendStringInfo(str, " ");
|
appendStringInfoChar(str, ' ');
|
||||||
WRITE_NODE_FIELD(name);
|
WRITE_NODE_FIELD(name);
|
||||||
appendStringInfo(str, " ALL ");
|
appendStringInfoString(str, " ALL ");
|
||||||
break;
|
break;
|
||||||
case AEXPR_DISTINCT:
|
case AEXPR_DISTINCT:
|
||||||
appendStringInfo(str, " DISTINCT ");
|
appendStringInfoString(str, " DISTINCT ");
|
||||||
WRITE_NODE_FIELD(name);
|
WRITE_NODE_FIELD(name);
|
||||||
break;
|
break;
|
||||||
case AEXPR_NULLIF:
|
case AEXPR_NULLIF:
|
||||||
appendStringInfo(str, " NULLIF ");
|
appendStringInfoString(str, " NULLIF ");
|
||||||
WRITE_NODE_FIELD(name);
|
WRITE_NODE_FIELD(name);
|
||||||
break;
|
break;
|
||||||
case AEXPR_OF:
|
case AEXPR_OF:
|
||||||
appendStringInfo(str, " OF ");
|
appendStringInfoString(str, " OF ");
|
||||||
WRITE_NODE_FIELD(name);
|
WRITE_NODE_FIELD(name);
|
||||||
break;
|
break;
|
||||||
case AEXPR_IN:
|
case AEXPR_IN:
|
||||||
appendStringInfo(str, " IN ");
|
appendStringInfoString(str, " IN ");
|
||||||
WRITE_NODE_FIELD(name);
|
WRITE_NODE_FIELD(name);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
appendStringInfo(str, " ??");
|
appendStringInfoString(str, " ??");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2527,7 +2527,7 @@ _outAConst(StringInfo str, const A_Const *node)
|
|||||||
{
|
{
|
||||||
WRITE_NODE_TYPE("A_CONST");
|
WRITE_NODE_TYPE("A_CONST");
|
||||||
|
|
||||||
appendStringInfo(str, " :val ");
|
appendStringInfoString(str, " :val ");
|
||||||
_outValue(str, &(node->val));
|
_outValue(str, &(node->val));
|
||||||
WRITE_LOCATION_FIELD(location);
|
WRITE_LOCATION_FIELD(location);
|
||||||
}
|
}
|
||||||
@ -2635,32 +2635,32 @@ _outConstraint(StringInfo str, const Constraint *node)
|
|||||||
WRITE_BOOL_FIELD(initdeferred);
|
WRITE_BOOL_FIELD(initdeferred);
|
||||||
WRITE_LOCATION_FIELD(location);
|
WRITE_LOCATION_FIELD(location);
|
||||||
|
|
||||||
appendStringInfo(str, " :contype ");
|
appendStringInfoString(str, " :contype ");
|
||||||
switch (node->contype)
|
switch (node->contype)
|
||||||
{
|
{
|
||||||
case CONSTR_NULL:
|
case CONSTR_NULL:
|
||||||
appendStringInfo(str, "NULL");
|
appendStringInfoString(str, "NULL");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CONSTR_NOTNULL:
|
case CONSTR_NOTNULL:
|
||||||
appendStringInfo(str, "NOT_NULL");
|
appendStringInfoString(str, "NOT_NULL");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CONSTR_DEFAULT:
|
case CONSTR_DEFAULT:
|
||||||
appendStringInfo(str, "DEFAULT");
|
appendStringInfoString(str, "DEFAULT");
|
||||||
WRITE_NODE_FIELD(raw_expr);
|
WRITE_NODE_FIELD(raw_expr);
|
||||||
WRITE_STRING_FIELD(cooked_expr);
|
WRITE_STRING_FIELD(cooked_expr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CONSTR_CHECK:
|
case CONSTR_CHECK:
|
||||||
appendStringInfo(str, "CHECK");
|
appendStringInfoString(str, "CHECK");
|
||||||
WRITE_BOOL_FIELD(is_no_inherit);
|
WRITE_BOOL_FIELD(is_no_inherit);
|
||||||
WRITE_NODE_FIELD(raw_expr);
|
WRITE_NODE_FIELD(raw_expr);
|
||||||
WRITE_STRING_FIELD(cooked_expr);
|
WRITE_STRING_FIELD(cooked_expr);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CONSTR_PRIMARY:
|
case CONSTR_PRIMARY:
|
||||||
appendStringInfo(str, "PRIMARY_KEY");
|
appendStringInfoString(str, "PRIMARY_KEY");
|
||||||
WRITE_NODE_FIELD(keys);
|
WRITE_NODE_FIELD(keys);
|
||||||
WRITE_NODE_FIELD(options);
|
WRITE_NODE_FIELD(options);
|
||||||
WRITE_STRING_FIELD(indexname);
|
WRITE_STRING_FIELD(indexname);
|
||||||
@ -2669,7 +2669,7 @@ _outConstraint(StringInfo str, const Constraint *node)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CONSTR_UNIQUE:
|
case CONSTR_UNIQUE:
|
||||||
appendStringInfo(str, "UNIQUE");
|
appendStringInfoString(str, "UNIQUE");
|
||||||
WRITE_NODE_FIELD(keys);
|
WRITE_NODE_FIELD(keys);
|
||||||
WRITE_NODE_FIELD(options);
|
WRITE_NODE_FIELD(options);
|
||||||
WRITE_STRING_FIELD(indexname);
|
WRITE_STRING_FIELD(indexname);
|
||||||
@ -2678,7 +2678,7 @@ _outConstraint(StringInfo str, const Constraint *node)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CONSTR_EXCLUSION:
|
case CONSTR_EXCLUSION:
|
||||||
appendStringInfo(str, "EXCLUSION");
|
appendStringInfoString(str, "EXCLUSION");
|
||||||
WRITE_NODE_FIELD(exclusions);
|
WRITE_NODE_FIELD(exclusions);
|
||||||
WRITE_NODE_FIELD(options);
|
WRITE_NODE_FIELD(options);
|
||||||
WRITE_STRING_FIELD(indexname);
|
WRITE_STRING_FIELD(indexname);
|
||||||
@ -2688,7 +2688,7 @@ _outConstraint(StringInfo str, const Constraint *node)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CONSTR_FOREIGN:
|
case CONSTR_FOREIGN:
|
||||||
appendStringInfo(str, "FOREIGN_KEY");
|
appendStringInfoString(str, "FOREIGN_KEY");
|
||||||
WRITE_NODE_FIELD(pktable);
|
WRITE_NODE_FIELD(pktable);
|
||||||
WRITE_NODE_FIELD(fk_attrs);
|
WRITE_NODE_FIELD(fk_attrs);
|
||||||
WRITE_NODE_FIELD(pk_attrs);
|
WRITE_NODE_FIELD(pk_attrs);
|
||||||
@ -2701,19 +2701,19 @@ _outConstraint(StringInfo str, const Constraint *node)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CONSTR_ATTR_DEFERRABLE:
|
case CONSTR_ATTR_DEFERRABLE:
|
||||||
appendStringInfo(str, "ATTR_DEFERRABLE");
|
appendStringInfoString(str, "ATTR_DEFERRABLE");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CONSTR_ATTR_NOT_DEFERRABLE:
|
case CONSTR_ATTR_NOT_DEFERRABLE:
|
||||||
appendStringInfo(str, "ATTR_NOT_DEFERRABLE");
|
appendStringInfoString(str, "ATTR_NOT_DEFERRABLE");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CONSTR_ATTR_DEFERRED:
|
case CONSTR_ATTR_DEFERRED:
|
||||||
appendStringInfo(str, "ATTR_DEFERRED");
|
appendStringInfoString(str, "ATTR_DEFERRED");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CONSTR_ATTR_IMMEDIATE:
|
case CONSTR_ATTR_IMMEDIATE:
|
||||||
appendStringInfo(str, "ATTR_IMMEDIATE");
|
appendStringInfoString(str, "ATTR_IMMEDIATE");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -2732,7 +2732,7 @@ static void
|
|||||||
_outNode(StringInfo str, const void *obj)
|
_outNode(StringInfo str, const void *obj)
|
||||||
{
|
{
|
||||||
if (obj == NULL)
|
if (obj == NULL)
|
||||||
appendStringInfo(str, "<>");
|
appendStringInfoString(str, "<>");
|
||||||
else if (IsA(obj, List) ||IsA(obj, IntList) || IsA(obj, OidList))
|
else if (IsA(obj, List) ||IsA(obj, IntList) || IsA(obj, OidList))
|
||||||
_outList(str, obj);
|
_outList(str, obj);
|
||||||
else if (IsA(obj, Integer) ||
|
else if (IsA(obj, Integer) ||
|
||||||
|
@ -4343,7 +4343,7 @@ ShowUsage(const char *title)
|
|||||||
*/
|
*/
|
||||||
initStringInfo(&str);
|
initStringInfo(&str);
|
||||||
|
|
||||||
appendStringInfo(&str, "! system usage stats:\n");
|
appendStringInfoString(&str, "! system usage stats:\n");
|
||||||
appendStringInfo(&str,
|
appendStringInfo(&str,
|
||||||
"!\t%ld.%06ld elapsed %ld.%06ld user %ld.%06ld system sec\n",
|
"!\t%ld.%06ld elapsed %ld.%06ld user %ld.%06ld system sec\n",
|
||||||
(long) (elapse_t.tv_sec - Save_t.tv_sec),
|
(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_qualified(operform->oprleft) :
|
||||||
format_type_be(operform->oprleft));
|
format_type_be(operform->oprleft));
|
||||||
else
|
else
|
||||||
appendStringInfo(&buf, "NONE,");
|
appendStringInfoString(&buf, "NONE,");
|
||||||
|
|
||||||
if (operform->oprright)
|
if (operform->oprright)
|
||||||
appendStringInfo(&buf, "%s)",
|
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_qualified(operform->oprright) :
|
||||||
format_type_be(operform->oprright));
|
format_type_be(operform->oprright));
|
||||||
else
|
else
|
||||||
appendStringInfo(&buf, "NONE)");
|
appendStringInfoString(&buf, "NONE)");
|
||||||
|
|
||||||
result = buf.data;
|
result = buf.data;
|
||||||
|
|
||||||
|
@ -427,7 +427,7 @@ RI_FKey_check(TriggerData *trigdata)
|
|||||||
querysep = "AND";
|
querysep = "AND";
|
||||||
queryoids[i] = fk_type;
|
queryoids[i] = fk_type;
|
||||||
}
|
}
|
||||||
appendStringInfo(&querybuf, " FOR KEY SHARE OF x");
|
appendStringInfoString(&querybuf, " FOR KEY SHARE OF x");
|
||||||
|
|
||||||
/* Prepare and save the plan */
|
/* Prepare and save the plan */
|
||||||
qplan = ri_PlanCheck(querybuf.data, riinfo->nkeys, queryoids,
|
qplan = ri_PlanCheck(querybuf.data, riinfo->nkeys, queryoids,
|
||||||
@ -562,7 +562,7 @@ ri_Check_Pk_Match(Relation pk_rel, Relation fk_rel,
|
|||||||
querysep = "AND";
|
querysep = "AND";
|
||||||
queryoids[i] = pk_type;
|
queryoids[i] = pk_type;
|
||||||
}
|
}
|
||||||
appendStringInfo(&querybuf, " FOR KEY SHARE OF x");
|
appendStringInfoString(&querybuf, " FOR KEY SHARE OF x");
|
||||||
|
|
||||||
/* Prepare and save the plan */
|
/* Prepare and save the plan */
|
||||||
qplan = ri_PlanCheck(querybuf.data, riinfo->nkeys, queryoids,
|
qplan = ri_PlanCheck(querybuf.data, riinfo->nkeys, queryoids,
|
||||||
@ -754,7 +754,7 @@ ri_restrict_del(TriggerData *trigdata, bool is_no_action)
|
|||||||
querysep = "AND";
|
querysep = "AND";
|
||||||
queryoids[i] = pk_type;
|
queryoids[i] = pk_type;
|
||||||
}
|
}
|
||||||
appendStringInfo(&querybuf, " FOR KEY SHARE OF x");
|
appendStringInfoString(&querybuf, " FOR KEY SHARE OF x");
|
||||||
|
|
||||||
/* Prepare and save the plan */
|
/* Prepare and save the plan */
|
||||||
qplan = ri_PlanCheck(querybuf.data, riinfo->nkeys, queryoids,
|
qplan = ri_PlanCheck(querybuf.data, riinfo->nkeys, queryoids,
|
||||||
@ -977,7 +977,7 @@ ri_restrict_upd(TriggerData *trigdata, bool is_no_action)
|
|||||||
querysep = "AND";
|
querysep = "AND";
|
||||||
queryoids[i] = pk_type;
|
queryoids[i] = pk_type;
|
||||||
}
|
}
|
||||||
appendStringInfo(&querybuf, " FOR KEY SHARE OF x");
|
appendStringInfoString(&querybuf, " FOR KEY SHARE OF x");
|
||||||
|
|
||||||
/* Prepare and save the plan */
|
/* Prepare and save the plan */
|
||||||
qplan = ri_PlanCheck(querybuf.data, riinfo->nkeys, queryoids,
|
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);
|
initStringInfo(&querybuf);
|
||||||
appendStringInfo(&querybuf, "SELECT ");
|
appendStringInfoString(&querybuf, "SELECT ");
|
||||||
sep = "";
|
sep = "";
|
||||||
for (i = 0; i < riinfo->nkeys; i++)
|
for (i = 0; i < riinfo->nkeys; i++)
|
||||||
{
|
{
|
||||||
@ -2391,7 +2391,7 @@ RI_Initial_Check(Trigger *trigger, Relation fk_rel, Relation pk_rel)
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
appendStringInfo(&querybuf, ")");
|
appendStringInfoChar(&querybuf, ')');
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Temporarily increase work_mem so that the check query can be executed
|
* Temporarily increase work_mem so that the check query can be executed
|
||||||
|
@ -483,7 +483,7 @@ pg_get_ruledef_worker(Oid ruleoid, int prettyFlags)
|
|||||||
if (spirc != SPI_OK_SELECT)
|
if (spirc != SPI_OK_SELECT)
|
||||||
elog(ERROR, "failed to get pg_rewrite tuple for rule %u", ruleoid);
|
elog(ERROR, "failed to get pg_rewrite tuple for rule %u", ruleoid);
|
||||||
if (SPI_processed != 1)
|
if (SPI_processed != 1)
|
||||||
appendStringInfo(&buf, "-");
|
appendStringInfoChar(&buf, '-');
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -638,7 +638,7 @@ pg_get_viewdef_worker(Oid viewoid, int prettyFlags, int wrapColumn)
|
|||||||
if (spirc != SPI_OK_SELECT)
|
if (spirc != SPI_OK_SELECT)
|
||||||
elog(ERROR, "failed to get pg_rewrite tuple for view %u", viewoid);
|
elog(ERROR, "failed to get pg_rewrite tuple for view %u", viewoid);
|
||||||
if (SPI_processed != 1)
|
if (SPI_processed != 1)
|
||||||
appendStringInfo(&buf, "Not a view");
|
appendStringInfoString(&buf, "Not a view");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
@ -725,33 +725,33 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty)
|
|||||||
quote_identifier(tgname));
|
quote_identifier(tgname));
|
||||||
|
|
||||||
if (TRIGGER_FOR_BEFORE(trigrec->tgtype))
|
if (TRIGGER_FOR_BEFORE(trigrec->tgtype))
|
||||||
appendStringInfo(&buf, "BEFORE");
|
appendStringInfoString(&buf, "BEFORE");
|
||||||
else if (TRIGGER_FOR_AFTER(trigrec->tgtype))
|
else if (TRIGGER_FOR_AFTER(trigrec->tgtype))
|
||||||
appendStringInfo(&buf, "AFTER");
|
appendStringInfoString(&buf, "AFTER");
|
||||||
else if (TRIGGER_FOR_INSTEAD(trigrec->tgtype))
|
else if (TRIGGER_FOR_INSTEAD(trigrec->tgtype))
|
||||||
appendStringInfo(&buf, "INSTEAD OF");
|
appendStringInfoString(&buf, "INSTEAD OF");
|
||||||
else
|
else
|
||||||
elog(ERROR, "unexpected tgtype value: %d", trigrec->tgtype);
|
elog(ERROR, "unexpected tgtype value: %d", trigrec->tgtype);
|
||||||
|
|
||||||
if (TRIGGER_FOR_INSERT(trigrec->tgtype))
|
if (TRIGGER_FOR_INSERT(trigrec->tgtype))
|
||||||
{
|
{
|
||||||
appendStringInfo(&buf, " INSERT");
|
appendStringInfoString(&buf, " INSERT");
|
||||||
findx++;
|
findx++;
|
||||||
}
|
}
|
||||||
if (TRIGGER_FOR_DELETE(trigrec->tgtype))
|
if (TRIGGER_FOR_DELETE(trigrec->tgtype))
|
||||||
{
|
{
|
||||||
if (findx > 0)
|
if (findx > 0)
|
||||||
appendStringInfo(&buf, " OR DELETE");
|
appendStringInfoString(&buf, " OR DELETE");
|
||||||
else
|
else
|
||||||
appendStringInfo(&buf, " DELETE");
|
appendStringInfoString(&buf, " DELETE");
|
||||||
findx++;
|
findx++;
|
||||||
}
|
}
|
||||||
if (TRIGGER_FOR_UPDATE(trigrec->tgtype))
|
if (TRIGGER_FOR_UPDATE(trigrec->tgtype))
|
||||||
{
|
{
|
||||||
if (findx > 0)
|
if (findx > 0)
|
||||||
appendStringInfo(&buf, " OR UPDATE");
|
appendStringInfoString(&buf, " OR UPDATE");
|
||||||
else
|
else
|
||||||
appendStringInfo(&buf, " UPDATE");
|
appendStringInfoString(&buf, " UPDATE");
|
||||||
findx++;
|
findx++;
|
||||||
/* tgattr is first var-width field, so OK to access directly */
|
/* tgattr is first var-width field, so OK to access directly */
|
||||||
if (trigrec->tgattr.dim1 > 0)
|
if (trigrec->tgattr.dim1 > 0)
|
||||||
@ -774,9 +774,9 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty)
|
|||||||
if (TRIGGER_FOR_TRUNCATE(trigrec->tgtype))
|
if (TRIGGER_FOR_TRUNCATE(trigrec->tgtype))
|
||||||
{
|
{
|
||||||
if (findx > 0)
|
if (findx > 0)
|
||||||
appendStringInfo(&buf, " OR TRUNCATE");
|
appendStringInfoString(&buf, " OR TRUNCATE");
|
||||||
else
|
else
|
||||||
appendStringInfo(&buf, " TRUNCATE");
|
appendStringInfoString(&buf, " TRUNCATE");
|
||||||
findx++;
|
findx++;
|
||||||
}
|
}
|
||||||
appendStringInfo(&buf, " ON %s ",
|
appendStringInfo(&buf, " ON %s ",
|
||||||
@ -788,18 +788,18 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty)
|
|||||||
appendStringInfo(&buf, "FROM %s ",
|
appendStringInfo(&buf, "FROM %s ",
|
||||||
generate_relation_name(trigrec->tgconstrrelid, NIL));
|
generate_relation_name(trigrec->tgconstrrelid, NIL));
|
||||||
if (!trigrec->tgdeferrable)
|
if (!trigrec->tgdeferrable)
|
||||||
appendStringInfo(&buf, "NOT ");
|
appendStringInfoString(&buf, "NOT ");
|
||||||
appendStringInfo(&buf, "DEFERRABLE INITIALLY ");
|
appendStringInfoString(&buf, "DEFERRABLE INITIALLY ");
|
||||||
if (trigrec->tginitdeferred)
|
if (trigrec->tginitdeferred)
|
||||||
appendStringInfo(&buf, "DEFERRED ");
|
appendStringInfoString(&buf, "DEFERRED ");
|
||||||
else
|
else
|
||||||
appendStringInfo(&buf, "IMMEDIATE ");
|
appendStringInfoString(&buf, "IMMEDIATE ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (TRIGGER_FOR_ROW(trigrec->tgtype))
|
if (TRIGGER_FOR_ROW(trigrec->tgtype))
|
||||||
appendStringInfo(&buf, "FOR EACH ROW ");
|
appendStringInfoString(&buf, "FOR EACH ROW ");
|
||||||
else
|
else
|
||||||
appendStringInfo(&buf, "FOR EACH STATEMENT ");
|
appendStringInfoString(&buf, "FOR EACH STATEMENT ");
|
||||||
|
|
||||||
/* If the trigger has a WHEN qualification, add that */
|
/* If the trigger has a WHEN qualification, add that */
|
||||||
value = fastgetattr(ht_trig, Anum_pg_trigger_tgqual,
|
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);
|
get_rule_expr(qual, &context, false);
|
||||||
|
|
||||||
appendStringInfo(&buf, ") ");
|
appendStringInfoString(&buf, ") ");
|
||||||
}
|
}
|
||||||
|
|
||||||
appendStringInfo(&buf, "EXECUTE PROCEDURE %s(",
|
appendStringInfo(&buf, "EXECUTE PROCEDURE %s(",
|
||||||
@ -880,7 +880,7 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty)
|
|||||||
for (i = 0; i < trigrec->tgnargs; i++)
|
for (i = 0; i < trigrec->tgnargs; i++)
|
||||||
{
|
{
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
appendStringInfo(&buf, ", ");
|
appendStringInfoString(&buf, ", ");
|
||||||
simple_quote_literal(&buf, p);
|
simple_quote_literal(&buf, p);
|
||||||
/* advance p to next string embedded in tgargs */
|
/* advance p to next string embedded in tgargs */
|
||||||
while (*p)
|
while (*p)
|
||||||
@ -890,7 +890,7 @@ pg_get_triggerdef_worker(Oid trigid, bool pretty)
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* We deliberately do not put semi-colon at end */
|
/* We deliberately do not put semi-colon at end */
|
||||||
appendStringInfo(&buf, ")");
|
appendStringInfoChar(&buf, ')');
|
||||||
|
|
||||||
/* Clean up */
|
/* Clean up */
|
||||||
systable_endscan(tgscan);
|
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 it supports sort ordering, report DESC and NULLS opts */
|
||||||
if (opt & INDOPTION_DESC)
|
if (opt & INDOPTION_DESC)
|
||||||
{
|
{
|
||||||
appendStringInfo(&buf, " DESC");
|
appendStringInfoString(&buf, " DESC");
|
||||||
/* NULLS FIRST is the default in this case */
|
/* NULLS FIRST is the default in this case */
|
||||||
if (!(opt & INDOPTION_NULLS_FIRST))
|
if (!(opt & INDOPTION_NULLS_FIRST))
|
||||||
appendStringInfo(&buf, " NULLS LAST");
|
appendStringInfoString(&buf, " NULLS LAST");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
if (opt & INDOPTION_NULLS_FIRST)
|
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;
|
const char *string;
|
||||||
|
|
||||||
/* Start off the constraint definition */
|
/* Start off the constraint definition */
|
||||||
appendStringInfo(&buf, "FOREIGN KEY (");
|
appendStringInfoString(&buf, "FOREIGN KEY (");
|
||||||
|
|
||||||
/* Fetch and build referencing-column list */
|
/* Fetch and build referencing-column list */
|
||||||
val = SysCacheGetAttr(CONSTROID, tup,
|
val = SysCacheGetAttr(CONSTROID, tup,
|
||||||
@ -1337,7 +1337,7 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand,
|
|||||||
|
|
||||||
decompile_column_index_array(val, conForm->confrelid, &buf);
|
decompile_column_index_array(val, conForm->confrelid, &buf);
|
||||||
|
|
||||||
appendStringInfo(&buf, ")");
|
appendStringInfoChar(&buf, ')');
|
||||||
|
|
||||||
/* Add match type */
|
/* Add match type */
|
||||||
switch (conForm->confmatchtype)
|
switch (conForm->confmatchtype)
|
||||||
@ -1423,9 +1423,9 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand,
|
|||||||
|
|
||||||
/* Start off the constraint definition */
|
/* Start off the constraint definition */
|
||||||
if (conForm->contype == CONSTRAINT_PRIMARY)
|
if (conForm->contype == CONSTRAINT_PRIMARY)
|
||||||
appendStringInfo(&buf, "PRIMARY KEY (");
|
appendStringInfoString(&buf, "PRIMARY KEY (");
|
||||||
else
|
else
|
||||||
appendStringInfo(&buf, "UNIQUE (");
|
appendStringInfoString(&buf, "UNIQUE (");
|
||||||
|
|
||||||
/* Fetch and build target column list */
|
/* Fetch and build target column list */
|
||||||
val = SysCacheGetAttr(CONSTROID, tup,
|
val = SysCacheGetAttr(CONSTROID, tup,
|
||||||
@ -1436,7 +1436,7 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand,
|
|||||||
|
|
||||||
decompile_column_index_array(val, conForm->conrelid, &buf);
|
decompile_column_index_array(val, conForm->conrelid, &buf);
|
||||||
|
|
||||||
appendStringInfo(&buf, ")");
|
appendStringInfoChar(&buf, ')');
|
||||||
|
|
||||||
indexId = get_constraint_index(constraintId);
|
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
|
* throw an error; if we throw error then this function couldn't
|
||||||
* safely be applied to all rows of pg_constraint.
|
* safely be applied to all rows of pg_constraint.
|
||||||
*/
|
*/
|
||||||
appendStringInfo(&buf, "TRIGGER");
|
appendStringInfoString(&buf, "TRIGGER");
|
||||||
break;
|
break;
|
||||||
case CONSTRAINT_EXCLUSION:
|
case CONSTRAINT_EXCLUSION:
|
||||||
{
|
{
|
||||||
@ -1565,9 +1565,9 @@ pg_get_constraintdef_worker(Oid constraintId, bool fullCommand,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (conForm->condeferrable)
|
if (conForm->condeferrable)
|
||||||
appendStringInfo(&buf, " DEFERRABLE");
|
appendStringInfoString(&buf, " DEFERRABLE");
|
||||||
if (conForm->condeferred)
|
if (conForm->condeferred)
|
||||||
appendStringInfo(&buf, " INITIALLY DEFERRED");
|
appendStringInfoString(&buf, " INITIALLY DEFERRED");
|
||||||
if (!conForm->convalidated)
|
if (!conForm->convalidated)
|
||||||
appendStringInfoString(&buf, " NOT VALID");
|
appendStringInfoString(&buf, " NOT VALID");
|
||||||
|
|
||||||
@ -2029,7 +2029,7 @@ pg_get_functiondef(PG_FUNCTION_ARGS)
|
|||||||
appendStringInfoString(&buf, prosrc);
|
appendStringInfoString(&buf, prosrc);
|
||||||
appendStringInfoString(&buf, dq.data);
|
appendStringInfoString(&buf, dq.data);
|
||||||
|
|
||||||
appendStringInfoString(&buf, "\n");
|
appendStringInfoChar(&buf, '\n');
|
||||||
|
|
||||||
ReleaseSysCache(langtup);
|
ReleaseSysCache(langtup);
|
||||||
ReleaseSysCache(proctup);
|
ReleaseSysCache(proctup);
|
||||||
@ -3789,19 +3789,19 @@ make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
|
|||||||
switch (ev_type)
|
switch (ev_type)
|
||||||
{
|
{
|
||||||
case '1':
|
case '1':
|
||||||
appendStringInfo(buf, "SELECT");
|
appendStringInfoString(buf, "SELECT");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '2':
|
case '2':
|
||||||
appendStringInfo(buf, "UPDATE");
|
appendStringInfoString(buf, "UPDATE");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '3':
|
case '3':
|
||||||
appendStringInfo(buf, "INSERT");
|
appendStringInfoString(buf, "INSERT");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case '4':
|
case '4':
|
||||||
appendStringInfo(buf, "DELETE");
|
appendStringInfoString(buf, "DELETE");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -3827,7 +3827,7 @@ make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
|
|||||||
|
|
||||||
if (prettyFlags & PRETTYFLAG_INDENT)
|
if (prettyFlags & PRETTYFLAG_INDENT)
|
||||||
appendStringInfoString(buf, "\n ");
|
appendStringInfoString(buf, "\n ");
|
||||||
appendStringInfo(buf, " WHERE ");
|
appendStringInfoString(buf, " WHERE ");
|
||||||
|
|
||||||
qual = stringToNode(ev_qual);
|
qual = stringToNode(ev_qual);
|
||||||
|
|
||||||
@ -3862,11 +3862,11 @@ make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
|
|||||||
get_rule_expr(qual, &context, false);
|
get_rule_expr(qual, &context, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
appendStringInfo(buf, " DO ");
|
appendStringInfoString(buf, " DO ");
|
||||||
|
|
||||||
/* The INSTEAD keyword (if so) */
|
/* The INSTEAD keyword (if so) */
|
||||||
if (is_instead)
|
if (is_instead)
|
||||||
appendStringInfo(buf, "INSTEAD ");
|
appendStringInfoString(buf, "INSTEAD ");
|
||||||
|
|
||||||
/* Finally the rules actions */
|
/* Finally the rules actions */
|
||||||
if (list_length(actions) > 1)
|
if (list_length(actions) > 1)
|
||||||
@ -3874,22 +3874,22 @@ make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
|
|||||||
ListCell *action;
|
ListCell *action;
|
||||||
Query *query;
|
Query *query;
|
||||||
|
|
||||||
appendStringInfo(buf, "(");
|
appendStringInfoChar(buf, '(');
|
||||||
foreach(action, actions)
|
foreach(action, actions)
|
||||||
{
|
{
|
||||||
query = (Query *) lfirst(action);
|
query = (Query *) lfirst(action);
|
||||||
get_query_def(query, buf, NIL, NULL,
|
get_query_def(query, buf, NIL, NULL,
|
||||||
prettyFlags, WRAP_COLUMN_DEFAULT, 0);
|
prettyFlags, WRAP_COLUMN_DEFAULT, 0);
|
||||||
if (prettyFlags)
|
if (prettyFlags)
|
||||||
appendStringInfo(buf, ";\n");
|
appendStringInfoString(buf, ";\n");
|
||||||
else
|
else
|
||||||
appendStringInfo(buf, "; ");
|
appendStringInfoString(buf, "; ");
|
||||||
}
|
}
|
||||||
appendStringInfo(buf, ");");
|
appendStringInfoString(buf, ");");
|
||||||
}
|
}
|
||||||
else if (list_length(actions) == 0)
|
else if (list_length(actions) == 0)
|
||||||
{
|
{
|
||||||
appendStringInfo(buf, "NOTHING;");
|
appendStringInfoString(buf, "NOTHING;");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -3898,7 +3898,7 @@ make_ruledef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
|
|||||||
query = (Query *) linitial(actions);
|
query = (Query *) linitial(actions);
|
||||||
get_query_def(query, buf, NIL, NULL,
|
get_query_def(query, buf, NIL, NULL,
|
||||||
prettyFlags, WRAP_COLUMN_DEFAULT, 0);
|
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)
|
if (list_length(actions) != 1)
|
||||||
{
|
{
|
||||||
appendStringInfo(buf, "Not a view");
|
appendStringInfoString(buf, "Not a view");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3954,7 +3954,7 @@ make_viewdef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
|
|||||||
if (ev_type != '1' || !is_instead ||
|
if (ev_type != '1' || !is_instead ||
|
||||||
strcmp(ev_qual, "<>") != 0 || query->commandType != CMD_SELECT)
|
strcmp(ev_qual, "<>") != 0 || query->commandType != CMD_SELECT)
|
||||||
{
|
{
|
||||||
appendStringInfo(buf, "Not a view");
|
appendStringInfoString(buf, "Not a view");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3962,7 +3962,7 @@ make_viewdef(StringInfo buf, HeapTuple ruletup, TupleDesc rulettc,
|
|||||||
|
|
||||||
get_query_def(query, buf, NIL, RelationGetDescr(ev_relation),
|
get_query_def(query, buf, NIL, RelationGetDescr(ev_relation),
|
||||||
prettyFlags, wrapColumn, 0);
|
prettyFlags, wrapColumn, 0);
|
||||||
appendStringInfo(buf, ";");
|
appendStringInfoChar(buf, ';');
|
||||||
|
|
||||||
heap_close(ev_relation, AccessShareLock);
|
heap_close(ev_relation, AccessShareLock);
|
||||||
}
|
}
|
||||||
@ -4022,7 +4022,7 @@ get_query_def(Query *query, StringInfo buf, List *parentnamespace,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_NOTHING:
|
case CMD_NOTHING:
|
||||||
appendStringInfo(buf, "NOTHING");
|
appendStringInfoString(buf, "NOTHING");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case CMD_UTILITY:
|
case CMD_UTILITY:
|
||||||
@ -4211,7 +4211,7 @@ get_select_query_def(Query *query, deparse_context *context,
|
|||||||
-PRETTYINDENT_STD, PRETTYINDENT_STD, 0);
|
-PRETTYINDENT_STD, PRETTYINDENT_STD, 0);
|
||||||
if (IsA(query->limitCount, Const) &&
|
if (IsA(query->limitCount, Const) &&
|
||||||
((Const *) query->limitCount)->constisnull)
|
((Const *) query->limitCount)->constisnull)
|
||||||
appendStringInfo(buf, "ALL");
|
appendStringInfoString(buf, "ALL");
|
||||||
else
|
else
|
||||||
get_rule_expr(query->limitCount, context, false);
|
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,
|
quote_identifier(get_rtable_name(rc->rti,
|
||||||
context)));
|
context)));
|
||||||
if (rc->noWait)
|
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
|
* Build up the query string - first we say SELECT
|
||||||
*/
|
*/
|
||||||
appendStringInfo(buf, "SELECT");
|
appendStringInfoString(buf, "SELECT");
|
||||||
|
|
||||||
/* Add the DISTINCT clause if given */
|
/* Add the DISTINCT clause if given */
|
||||||
if (query->distinctClause != NIL)
|
if (query->distinctClause != NIL)
|
||||||
{
|
{
|
||||||
if (query->hasDistinctOn)
|
if (query->hasDistinctOn)
|
||||||
{
|
{
|
||||||
appendStringInfo(buf, " DISTINCT ON (");
|
appendStringInfoString(buf, " DISTINCT ON (");
|
||||||
sep = "";
|
sep = "";
|
||||||
foreach(l, query->distinctClause)
|
foreach(l, query->distinctClause)
|
||||||
{
|
{
|
||||||
@ -4343,10 +4343,10 @@ get_basic_select_query(Query *query, deparse_context *context,
|
|||||||
false, context);
|
false, context);
|
||||||
sep = ", ";
|
sep = ", ";
|
||||||
}
|
}
|
||||||
appendStringInfo(buf, ")");
|
appendStringInfoChar(buf, ')');
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
appendStringInfo(buf, " DISTINCT");
|
appendStringInfoString(buf, " DISTINCT");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Then we tell what to select (the targetlist) */
|
/* 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);
|
(int) op->op);
|
||||||
}
|
}
|
||||||
if (op->all)
|
if (op->all)
|
||||||
appendStringInfo(buf, "ALL ");
|
appendStringInfoString(buf, "ALL ");
|
||||||
|
|
||||||
if (PRETTY_INDENT(context))
|
if (PRETTY_INDENT(context))
|
||||||
appendContextKeyword(context, "", 0, 0, 0);
|
appendContextKeyword(context, "", 0, 0, 0);
|
||||||
@ -4693,14 +4693,14 @@ get_rule_orderby(List *orderList, List *targetList,
|
|||||||
{
|
{
|
||||||
/* ASC is default, so emit nothing for it */
|
/* ASC is default, so emit nothing for it */
|
||||||
if (srt->nulls_first)
|
if (srt->nulls_first)
|
||||||
appendStringInfo(buf, " NULLS FIRST");
|
appendStringInfoString(buf, " NULLS FIRST");
|
||||||
}
|
}
|
||||||
else if (srt->sortop == typentry->gt_opr)
|
else if (srt->sortop == typentry->gt_opr)
|
||||||
{
|
{
|
||||||
appendStringInfo(buf, " DESC");
|
appendStringInfoString(buf, " DESC");
|
||||||
/* DESC defaults to NULLS FIRST */
|
/* DESC defaults to NULLS FIRST */
|
||||||
if (!srt->nulls_first)
|
if (!srt->nulls_first)
|
||||||
appendStringInfo(buf, " NULLS LAST");
|
appendStringInfoString(buf, " NULLS LAST");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -4710,9 +4710,9 @@ get_rule_orderby(List *orderList, List *targetList,
|
|||||||
sortcoltype));
|
sortcoltype));
|
||||||
/* be specific to eliminate ambiguity */
|
/* be specific to eliminate ambiguity */
|
||||||
if (srt->nulls_first)
|
if (srt->nulls_first)
|
||||||
appendStringInfo(buf, " NULLS FIRST");
|
appendStringInfoString(buf, " NULLS FIRST");
|
||||||
else
|
else
|
||||||
appendStringInfo(buf, " NULLS LAST");
|
appendStringInfoString(buf, " NULLS LAST");
|
||||||
}
|
}
|
||||||
sep = ", ";
|
sep = ", ";
|
||||||
}
|
}
|
||||||
@ -4964,7 +4964,7 @@ get_insert_query_def(Query *query, deparse_context *context)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (query->targetList)
|
if (query->targetList)
|
||||||
appendStringInfo(buf, ") ");
|
appendStringInfoString(buf, ") ");
|
||||||
|
|
||||||
if (select_rte)
|
if (select_rte)
|
||||||
{
|
{
|
||||||
@ -4989,7 +4989,7 @@ get_insert_query_def(Query *query, deparse_context *context)
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
/* No expressions, so it must be DEFAULT VALUES */
|
/* No expressions, so it must be DEFAULT VALUES */
|
||||||
appendStringInfo(buf, "DEFAULT VALUES");
|
appendStringInfoString(buf, "DEFAULT VALUES");
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Add RETURNING if present */
|
/* Add RETURNING if present */
|
||||||
@ -5062,7 +5062,7 @@ get_update_query_def(Query *query, deparse_context *context)
|
|||||||
*/
|
*/
|
||||||
expr = processIndirection((Node *) tle->expr, context, true);
|
expr = processIndirection((Node *) tle->expr, context, true);
|
||||||
|
|
||||||
appendStringInfo(buf, " = ");
|
appendStringInfoString(buf, " = ");
|
||||||
|
|
||||||
get_rule_expr(expr, context, false);
|
get_rule_expr(expr, context, false);
|
||||||
}
|
}
|
||||||
@ -6426,7 +6426,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
|||||||
if (!PRETTY_PAREN(context))
|
if (!PRETTY_PAREN(context))
|
||||||
appendStringInfoChar(buf, '(');
|
appendStringInfoChar(buf, '(');
|
||||||
get_rule_expr_paren(arg1, context, true, node);
|
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);
|
get_rule_expr_paren(arg2, context, true, node);
|
||||||
if (!PRETTY_PAREN(context))
|
if (!PRETTY_PAREN(context))
|
||||||
appendStringInfoChar(buf, ')');
|
appendStringInfoChar(buf, ')');
|
||||||
@ -6437,7 +6437,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
|||||||
{
|
{
|
||||||
NullIfExpr *nullifexpr = (NullIfExpr *) node;
|
NullIfExpr *nullifexpr = (NullIfExpr *) node;
|
||||||
|
|
||||||
appendStringInfo(buf, "NULLIF(");
|
appendStringInfoString(buf, "NULLIF(");
|
||||||
get_rule_expr((Node *) nullifexpr->args, context, true);
|
get_rule_expr((Node *) nullifexpr->args, context, true);
|
||||||
appendStringInfoChar(buf, ')');
|
appendStringInfoChar(buf, ')');
|
||||||
}
|
}
|
||||||
@ -6480,7 +6480,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
|||||||
false, node);
|
false, node);
|
||||||
while (arg)
|
while (arg)
|
||||||
{
|
{
|
||||||
appendStringInfo(buf, " AND ");
|
appendStringInfoString(buf, " AND ");
|
||||||
get_rule_expr_paren((Node *) lfirst(arg), context,
|
get_rule_expr_paren((Node *) lfirst(arg), context,
|
||||||
false, node);
|
false, node);
|
||||||
arg = lnext(arg);
|
arg = lnext(arg);
|
||||||
@ -6496,7 +6496,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
|||||||
false, node);
|
false, node);
|
||||||
while (arg)
|
while (arg)
|
||||||
{
|
{
|
||||||
appendStringInfo(buf, " OR ");
|
appendStringInfoString(buf, " OR ");
|
||||||
get_rule_expr_paren((Node *) lfirst(arg), context,
|
get_rule_expr_paren((Node *) lfirst(arg), context,
|
||||||
false, node);
|
false, node);
|
||||||
arg = lnext(arg);
|
arg = lnext(arg);
|
||||||
@ -6508,7 +6508,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
|||||||
case NOT_EXPR:
|
case NOT_EXPR:
|
||||||
if (!PRETTY_PAREN(context))
|
if (!PRETTY_PAREN(context))
|
||||||
appendStringInfoChar(buf, '(');
|
appendStringInfoChar(buf, '(');
|
||||||
appendStringInfo(buf, "NOT ");
|
appendStringInfoString(buf, "NOT ");
|
||||||
get_rule_expr_paren(first_arg, context,
|
get_rule_expr_paren(first_arg, context,
|
||||||
false, node);
|
false, node);
|
||||||
if (!PRETTY_PAREN(context))
|
if (!PRETTY_PAREN(context))
|
||||||
@ -6549,7 +6549,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
|||||||
ListCell *lc;
|
ListCell *lc;
|
||||||
|
|
||||||
/* As above, this can only happen during EXPLAIN */
|
/* As above, this can only happen during EXPLAIN */
|
||||||
appendStringInfo(buf, "(alternatives: ");
|
appendStringInfoString(buf, "(alternatives: ");
|
||||||
foreach(lc, asplan->subplans)
|
foreach(lc, asplan->subplans)
|
||||||
{
|
{
|
||||||
SubPlan *splan = (SubPlan *) lfirst(lc);
|
SubPlan *splan = (SubPlan *) lfirst(lc);
|
||||||
@ -6558,11 +6558,11 @@ get_rule_expr(Node *node, deparse_context *context,
|
|||||||
if (splan->useHashTable)
|
if (splan->useHashTable)
|
||||||
appendStringInfo(buf, "hashed %s", splan->plan_name);
|
appendStringInfo(buf, "hashed %s", splan->plan_name);
|
||||||
else
|
else
|
||||||
appendStringInfo(buf, "%s", splan->plan_name);
|
appendStringInfoString(buf, splan->plan_name);
|
||||||
if (lnext(lc))
|
if (lnext(lc))
|
||||||
appendStringInfo(buf, " or ");
|
appendStringInfoString(buf, " or ");
|
||||||
}
|
}
|
||||||
appendStringInfo(buf, ")");
|
appendStringInfoChar(buf, ')');
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -6774,7 +6774,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
|||||||
appendContextKeyword(context, "WHEN ",
|
appendContextKeyword(context, "WHEN ",
|
||||||
0, 0, 0);
|
0, 0, 0);
|
||||||
get_rule_expr(w, context, false);
|
get_rule_expr(w, context, false);
|
||||||
appendStringInfo(buf, " THEN ");
|
appendStringInfoString(buf, " THEN ");
|
||||||
get_rule_expr((Node *) when->result, context, true);
|
get_rule_expr((Node *) when->result, context, true);
|
||||||
}
|
}
|
||||||
if (!PRETTY_INDENT(context))
|
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
|
* be unable to avoid that (see comments for CaseExpr). If we
|
||||||
* do see one, print it as CASE_TEST_EXPR.
|
* do see one, print it as CASE_TEST_EXPR.
|
||||||
*/
|
*/
|
||||||
appendStringInfo(buf, "CASE_TEST_EXPR");
|
appendStringInfoString(buf, "CASE_TEST_EXPR");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -6806,7 +6806,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
|||||||
{
|
{
|
||||||
ArrayExpr *arrayexpr = (ArrayExpr *) node;
|
ArrayExpr *arrayexpr = (ArrayExpr *) node;
|
||||||
|
|
||||||
appendStringInfo(buf, "ARRAY[");
|
appendStringInfoString(buf, "ARRAY[");
|
||||||
get_rule_expr((Node *) arrayexpr->elements, context, true);
|
get_rule_expr((Node *) arrayexpr->elements, context, true);
|
||||||
appendStringInfoChar(buf, ']');
|
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
|
* SQL99 allows "ROW" to be omitted when there is more than
|
||||||
* one column, but for simplicity we always print it.
|
* one column, but for simplicity we always print it.
|
||||||
*/
|
*/
|
||||||
appendStringInfo(buf, "ROW(");
|
appendStringInfoString(buf, "ROW(");
|
||||||
sep = "";
|
sep = "";
|
||||||
i = 0;
|
i = 0;
|
||||||
foreach(arg, rowexpr->args)
|
foreach(arg, rowexpr->args)
|
||||||
@ -6867,7 +6867,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
|||||||
if (!tupdesc->attrs[i]->attisdropped)
|
if (!tupdesc->attrs[i]->attisdropped)
|
||||||
{
|
{
|
||||||
appendStringInfoString(buf, sep);
|
appendStringInfoString(buf, sep);
|
||||||
appendStringInfo(buf, "NULL");
|
appendStringInfoString(buf, "NULL");
|
||||||
sep = ", ";
|
sep = ", ";
|
||||||
}
|
}
|
||||||
i++;
|
i++;
|
||||||
@ -6875,7 +6875,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
|||||||
|
|
||||||
ReleaseTupleDesc(tupdesc);
|
ReleaseTupleDesc(tupdesc);
|
||||||
}
|
}
|
||||||
appendStringInfo(buf, ")");
|
appendStringInfoChar(buf, ')');
|
||||||
if (rowexpr->row_format == COERCE_EXPLICIT_CAST)
|
if (rowexpr->row_format == COERCE_EXPLICIT_CAST)
|
||||||
appendStringInfo(buf, "::%s",
|
appendStringInfo(buf, "::%s",
|
||||||
format_type_with_typemod(rowexpr->row_typeid, -1));
|
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
|
* SQL99 allows "ROW" to be omitted when there is more than
|
||||||
* one column, but for simplicity we always print it.
|
* one column, but for simplicity we always print it.
|
||||||
*/
|
*/
|
||||||
appendStringInfo(buf, "(ROW(");
|
appendStringInfoString(buf, "(ROW(");
|
||||||
sep = "";
|
sep = "";
|
||||||
foreach(arg, rcexpr->largs)
|
foreach(arg, rcexpr->largs)
|
||||||
{
|
{
|
||||||
@ -6923,7 +6923,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
|||||||
get_rule_expr(e, context, true);
|
get_rule_expr(e, context, true);
|
||||||
sep = ", ";
|
sep = ", ";
|
||||||
}
|
}
|
||||||
appendStringInfo(buf, "))");
|
appendStringInfoString(buf, "))");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -6931,7 +6931,7 @@ get_rule_expr(Node *node, deparse_context *context,
|
|||||||
{
|
{
|
||||||
CoalesceExpr *coalesceexpr = (CoalesceExpr *) node;
|
CoalesceExpr *coalesceexpr = (CoalesceExpr *) node;
|
||||||
|
|
||||||
appendStringInfo(buf, "COALESCE(");
|
appendStringInfoString(buf, "COALESCE(");
|
||||||
get_rule_expr((Node *) coalesceexpr->args, context, true);
|
get_rule_expr((Node *) coalesceexpr->args, context, true);
|
||||||
appendStringInfoChar(buf, ')');
|
appendStringInfoChar(buf, ')');
|
||||||
}
|
}
|
||||||
@ -6944,10 +6944,10 @@ get_rule_expr(Node *node, deparse_context *context,
|
|||||||
switch (minmaxexpr->op)
|
switch (minmaxexpr->op)
|
||||||
{
|
{
|
||||||
case IS_GREATEST:
|
case IS_GREATEST:
|
||||||
appendStringInfo(buf, "GREATEST(");
|
appendStringInfoString(buf, "GREATEST(");
|
||||||
break;
|
break;
|
||||||
case IS_LEAST:
|
case IS_LEAST:
|
||||||
appendStringInfo(buf, "LEAST(");
|
appendStringInfoString(buf, "LEAST(");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
get_rule_expr((Node *) minmaxexpr->args, context, true);
|
get_rule_expr((Node *) minmaxexpr->args, context, true);
|
||||||
@ -7122,10 +7122,10 @@ get_rule_expr(Node *node, deparse_context *context,
|
|||||||
switch (ntest->nulltesttype)
|
switch (ntest->nulltesttype)
|
||||||
{
|
{
|
||||||
case IS_NULL:
|
case IS_NULL:
|
||||||
appendStringInfo(buf, " IS NULL");
|
appendStringInfoString(buf, " IS NULL");
|
||||||
break;
|
break;
|
||||||
case IS_NOT_NULL:
|
case IS_NOT_NULL:
|
||||||
appendStringInfo(buf, " IS NOT NULL");
|
appendStringInfoString(buf, " IS NOT NULL");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "unrecognized nulltesttype: %d",
|
elog(ERROR, "unrecognized nulltesttype: %d",
|
||||||
@ -7146,22 +7146,22 @@ get_rule_expr(Node *node, deparse_context *context,
|
|||||||
switch (btest->booltesttype)
|
switch (btest->booltesttype)
|
||||||
{
|
{
|
||||||
case IS_TRUE:
|
case IS_TRUE:
|
||||||
appendStringInfo(buf, " IS TRUE");
|
appendStringInfoString(buf, " IS TRUE");
|
||||||
break;
|
break;
|
||||||
case IS_NOT_TRUE:
|
case IS_NOT_TRUE:
|
||||||
appendStringInfo(buf, " IS NOT TRUE");
|
appendStringInfoString(buf, " IS NOT TRUE");
|
||||||
break;
|
break;
|
||||||
case IS_FALSE:
|
case IS_FALSE:
|
||||||
appendStringInfo(buf, " IS FALSE");
|
appendStringInfoString(buf, " IS FALSE");
|
||||||
break;
|
break;
|
||||||
case IS_NOT_FALSE:
|
case IS_NOT_FALSE:
|
||||||
appendStringInfo(buf, " IS NOT FALSE");
|
appendStringInfoString(buf, " IS NOT FALSE");
|
||||||
break;
|
break;
|
||||||
case IS_UNKNOWN:
|
case IS_UNKNOWN:
|
||||||
appendStringInfo(buf, " IS UNKNOWN");
|
appendStringInfoString(buf, " IS UNKNOWN");
|
||||||
break;
|
break;
|
||||||
case IS_NOT_UNKNOWN:
|
case IS_NOT_UNKNOWN:
|
||||||
appendStringInfo(buf, " IS NOT UNKNOWN");
|
appendStringInfoString(buf, " IS NOT UNKNOWN");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
elog(ERROR, "unrecognized booltesttype: %d",
|
elog(ERROR, "unrecognized booltesttype: %d",
|
||||||
@ -7194,11 +7194,11 @@ get_rule_expr(Node *node, deparse_context *context,
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case T_CoerceToDomainValue:
|
case T_CoerceToDomainValue:
|
||||||
appendStringInfo(buf, "VALUE");
|
appendStringInfoString(buf, "VALUE");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_SetToDefault:
|
case T_SetToDefault:
|
||||||
appendStringInfo(buf, "DEFAULT");
|
appendStringInfoString(buf, "DEFAULT");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case T_CurrentOfExpr:
|
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
|
* Always label the type of a NULL constant to prevent misdecisions
|
||||||
* about type when reparsing.
|
* about type when reparsing.
|
||||||
*/
|
*/
|
||||||
appendStringInfo(buf, "NULL");
|
appendStringInfoString(buf, "NULL");
|
||||||
if (showtype >= 0)
|
if (showtype >= 0)
|
||||||
{
|
{
|
||||||
appendStringInfo(buf, "::%s",
|
appendStringInfo(buf, "::%s",
|
||||||
@ -7654,9 +7654,9 @@ get_const_expr(Const *constval, deparse_context *context, int showtype)
|
|||||||
|
|
||||||
case BOOLOID:
|
case BOOLOID:
|
||||||
if (strcmp(extval, "t") == 0)
|
if (strcmp(extval, "t") == 0)
|
||||||
appendStringInfo(buf, "true");
|
appendStringInfoString(buf, "true");
|
||||||
else
|
else
|
||||||
appendStringInfo(buf, "false");
|
appendStringInfoString(buf, "false");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
@ -7763,7 +7763,7 @@ get_sublink_expr(SubLink *sublink, deparse_context *context)
|
|||||||
bool need_paren;
|
bool need_paren;
|
||||||
|
|
||||||
if (sublink->subLinkType == ARRAY_SUBLINK)
|
if (sublink->subLinkType == ARRAY_SUBLINK)
|
||||||
appendStringInfo(buf, "ARRAY(");
|
appendStringInfoString(buf, "ARRAY(");
|
||||||
else
|
else
|
||||||
appendStringInfoChar(buf, '(');
|
appendStringInfoChar(buf, '(');
|
||||||
|
|
||||||
@ -7831,12 +7831,12 @@ get_sublink_expr(SubLink *sublink, deparse_context *context)
|
|||||||
switch (sublink->subLinkType)
|
switch (sublink->subLinkType)
|
||||||
{
|
{
|
||||||
case EXISTS_SUBLINK:
|
case EXISTS_SUBLINK:
|
||||||
appendStringInfo(buf, "EXISTS ");
|
appendStringInfoString(buf, "EXISTS ");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ANY_SUBLINK:
|
case ANY_SUBLINK:
|
||||||
if (strcmp(opname, "=") == 0) /* Represent = ANY as IN */
|
if (strcmp(opname, "=") == 0) /* Represent = ANY as IN */
|
||||||
appendStringInfo(buf, " IN ");
|
appendStringInfoString(buf, " IN ");
|
||||||
else
|
else
|
||||||
appendStringInfo(buf, " %s ANY ", opname);
|
appendStringInfo(buf, " %s ANY ", opname);
|
||||||
break;
|
break;
|
||||||
@ -7869,7 +7869,7 @@ get_sublink_expr(SubLink *sublink, deparse_context *context)
|
|||||||
context->indentLevel);
|
context->indentLevel);
|
||||||
|
|
||||||
if (need_paren)
|
if (need_paren)
|
||||||
appendStringInfo(buf, "))");
|
appendStringInfoString(buf, "))");
|
||||||
else
|
else
|
||||||
appendStringInfoChar(buf, ')');
|
appendStringInfoChar(buf, ')');
|
||||||
}
|
}
|
||||||
@ -8140,7 +8140,7 @@ get_from_clause_item(Node *jtnode, Query *query, deparse_context *context)
|
|||||||
ListCell *lc;
|
ListCell *lc;
|
||||||
bool first = true;
|
bool first = true;
|
||||||
|
|
||||||
appendStringInfo(buf, " USING (");
|
appendStringInfoString(buf, " USING (");
|
||||||
/* Use the assigned names, not what's in usingClause */
|
/* Use the assigned names, not what's in usingClause */
|
||||||
foreach(lc, colinfo->usingNames)
|
foreach(lc, colinfo->usingNames)
|
||||||
{
|
{
|
||||||
@ -8149,14 +8149,14 @@ get_from_clause_item(Node *jtnode, Query *query, deparse_context *context)
|
|||||||
if (first)
|
if (first)
|
||||||
first = false;
|
first = false;
|
||||||
else
|
else
|
||||||
appendStringInfo(buf, ", ");
|
appendStringInfoString(buf, ", ");
|
||||||
appendStringInfoString(buf, quote_identifier(colname));
|
appendStringInfoString(buf, quote_identifier(colname));
|
||||||
}
|
}
|
||||||
appendStringInfoChar(buf, ')');
|
appendStringInfoChar(buf, ')');
|
||||||
}
|
}
|
||||||
else if (j->quals)
|
else if (j->quals)
|
||||||
{
|
{
|
||||||
appendStringInfo(buf, " ON ");
|
appendStringInfoString(buf, " ON ");
|
||||||
if (!PRETTY_PAREN(context))
|
if (!PRETTY_PAREN(context))
|
||||||
appendStringInfoChar(buf, '(');
|
appendStringInfoChar(buf, '(');
|
||||||
get_rule_expr(j->quals, context, false);
|
get_rule_expr(j->quals, context, false);
|
||||||
@ -8206,7 +8206,7 @@ get_column_alias_list(deparse_columns *colinfo, deparse_context *context)
|
|||||||
first = false;
|
first = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
appendStringInfo(buf, ", ");
|
appendStringInfoString(buf, ", ");
|
||||||
appendStringInfoString(buf, quote_identifier(colname));
|
appendStringInfoString(buf, quote_identifier(colname));
|
||||||
}
|
}
|
||||||
if (!first)
|
if (!first)
|
||||||
@ -8243,7 +8243,7 @@ get_from_clause_coldeflist(deparse_columns *colinfo,
|
|||||||
Assert(attname); /* shouldn't be any dropped columns here */
|
Assert(attname); /* shouldn't be any dropped columns here */
|
||||||
|
|
||||||
if (i > 0)
|
if (i > 0)
|
||||||
appendStringInfo(buf, ", ");
|
appendStringInfoString(buf, ", ");
|
||||||
appendStringInfo(buf, "%s %s",
|
appendStringInfo(buf, "%s %s",
|
||||||
quote_identifier(attname),
|
quote_identifier(attname),
|
||||||
format_type_with_typemod(atttypid, atttypmod));
|
format_type_with_typemod(atttypid, atttypmod));
|
||||||
|
@ -442,9 +442,9 @@ xmlcomment(PG_FUNCTION_ARGS)
|
|||||||
errmsg("invalid XML comment")));
|
errmsg("invalid XML comment")));
|
||||||
|
|
||||||
initStringInfo(&buf);
|
initStringInfo(&buf);
|
||||||
appendStringInfo(&buf, "<!--");
|
appendStringInfoString(&buf, "<!--");
|
||||||
appendStringInfoText(&buf, arg);
|
appendStringInfoText(&buf, arg);
|
||||||
appendStringInfo(&buf, "-->");
|
appendStringInfoString(&buf, "-->");
|
||||||
|
|
||||||
PG_RETURN_XML_P(stringinfo_to_xmltype(&buf));
|
PG_RETURN_XML_P(stringinfo_to_xmltype(&buf));
|
||||||
#else
|
#else
|
||||||
@ -1852,19 +1852,19 @@ map_sql_identifier_to_xml_name(char *ident, bool fully_escaped,
|
|||||||
for (p = ident; *p; p += pg_mblen(p))
|
for (p = ident; *p; p += pg_mblen(p))
|
||||||
{
|
{
|
||||||
if (*p == ':' && (p == ident || fully_escaped))
|
if (*p == ':' && (p == ident || fully_escaped))
|
||||||
appendStringInfo(&buf, "_x003A_");
|
appendStringInfoString(&buf, "_x003A_");
|
||||||
else if (*p == '_' && *(p + 1) == 'x')
|
else if (*p == '_' && *(p + 1) == 'x')
|
||||||
appendStringInfo(&buf, "_x005F_");
|
appendStringInfoString(&buf, "_x005F_");
|
||||||
else if (fully_escaped && p == ident &&
|
else if (fully_escaped && p == ident &&
|
||||||
pg_strncasecmp(p, "xml", 3) == 0)
|
pg_strncasecmp(p, "xml", 3) == 0)
|
||||||
{
|
{
|
||||||
if (*p == 'x')
|
if (*p == 'x')
|
||||||
appendStringInfo(&buf, "_x0078_");
|
appendStringInfoString(&buf, "_x0078_");
|
||||||
else
|
else
|
||||||
appendStringInfo(&buf, "_x0058_");
|
appendStringInfoString(&buf, "_x0058_");
|
||||||
}
|
}
|
||||||
else if (escape_period && *p == '.')
|
else if (escape_period && *p == '.')
|
||||||
appendStringInfo(&buf, "_x002E_");
|
appendStringInfoString(&buf, "_x002E_");
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
pg_wchar u = sqlchar_to_unicode(p);
|
pg_wchar u = sqlchar_to_unicode(p);
|
||||||
@ -2438,9 +2438,9 @@ xmldata_root_element_start(StringInfo result, const char *eltname,
|
|||||||
if (strlen(targetns) > 0)
|
if (strlen(targetns) > 0)
|
||||||
appendStringInfo(result, " xsi:schemaLocation=\"%s #\"", targetns);
|
appendStringInfo(result, " xsi:schemaLocation=\"%s #\"", targetns);
|
||||||
else
|
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);
|
initStringInfo(&result);
|
||||||
|
|
||||||
if (a)
|
if (a)
|
||||||
appendStringInfo(&result, "%s",
|
appendStringInfoString(&result,
|
||||||
map_sql_identifier_to_xml_name(a, true, true));
|
map_sql_identifier_to_xml_name(a, true, true));
|
||||||
if (b)
|
if (b)
|
||||||
appendStringInfo(&result, ".%s",
|
appendStringInfo(&result, ".%s",
|
||||||
@ -3212,71 +3212,71 @@ map_sql_type_to_xml_name(Oid typeoid, int typmod)
|
|||||||
{
|
{
|
||||||
case BPCHAROID:
|
case BPCHAROID:
|
||||||
if (typmod == -1)
|
if (typmod == -1)
|
||||||
appendStringInfo(&result, "CHAR");
|
appendStringInfoString(&result, "CHAR");
|
||||||
else
|
else
|
||||||
appendStringInfo(&result, "CHAR_%d", typmod - VARHDRSZ);
|
appendStringInfo(&result, "CHAR_%d", typmod - VARHDRSZ);
|
||||||
break;
|
break;
|
||||||
case VARCHAROID:
|
case VARCHAROID:
|
||||||
if (typmod == -1)
|
if (typmod == -1)
|
||||||
appendStringInfo(&result, "VARCHAR");
|
appendStringInfoString(&result, "VARCHAR");
|
||||||
else
|
else
|
||||||
appendStringInfo(&result, "VARCHAR_%d", typmod - VARHDRSZ);
|
appendStringInfo(&result, "VARCHAR_%d", typmod - VARHDRSZ);
|
||||||
break;
|
break;
|
||||||
case NUMERICOID:
|
case NUMERICOID:
|
||||||
if (typmod == -1)
|
if (typmod == -1)
|
||||||
appendStringInfo(&result, "NUMERIC");
|
appendStringInfoString(&result, "NUMERIC");
|
||||||
else
|
else
|
||||||
appendStringInfo(&result, "NUMERIC_%d_%d",
|
appendStringInfo(&result, "NUMERIC_%d_%d",
|
||||||
((typmod - VARHDRSZ) >> 16) & 0xffff,
|
((typmod - VARHDRSZ) >> 16) & 0xffff,
|
||||||
(typmod - VARHDRSZ) & 0xffff);
|
(typmod - VARHDRSZ) & 0xffff);
|
||||||
break;
|
break;
|
||||||
case INT4OID:
|
case INT4OID:
|
||||||
appendStringInfo(&result, "INTEGER");
|
appendStringInfoString(&result, "INTEGER");
|
||||||
break;
|
break;
|
||||||
case INT2OID:
|
case INT2OID:
|
||||||
appendStringInfo(&result, "SMALLINT");
|
appendStringInfoString(&result, "SMALLINT");
|
||||||
break;
|
break;
|
||||||
case INT8OID:
|
case INT8OID:
|
||||||
appendStringInfo(&result, "BIGINT");
|
appendStringInfoString(&result, "BIGINT");
|
||||||
break;
|
break;
|
||||||
case FLOAT4OID:
|
case FLOAT4OID:
|
||||||
appendStringInfo(&result, "REAL");
|
appendStringInfoString(&result, "REAL");
|
||||||
break;
|
break;
|
||||||
case FLOAT8OID:
|
case FLOAT8OID:
|
||||||
appendStringInfo(&result, "DOUBLE");
|
appendStringInfoString(&result, "DOUBLE");
|
||||||
break;
|
break;
|
||||||
case BOOLOID:
|
case BOOLOID:
|
||||||
appendStringInfo(&result, "BOOLEAN");
|
appendStringInfoString(&result, "BOOLEAN");
|
||||||
break;
|
break;
|
||||||
case TIMEOID:
|
case TIMEOID:
|
||||||
if (typmod == -1)
|
if (typmod == -1)
|
||||||
appendStringInfo(&result, "TIME");
|
appendStringInfoString(&result, "TIME");
|
||||||
else
|
else
|
||||||
appendStringInfo(&result, "TIME_%d", typmod);
|
appendStringInfo(&result, "TIME_%d", typmod);
|
||||||
break;
|
break;
|
||||||
case TIMETZOID:
|
case TIMETZOID:
|
||||||
if (typmod == -1)
|
if (typmod == -1)
|
||||||
appendStringInfo(&result, "TIME_WTZ");
|
appendStringInfoString(&result, "TIME_WTZ");
|
||||||
else
|
else
|
||||||
appendStringInfo(&result, "TIME_WTZ_%d", typmod);
|
appendStringInfo(&result, "TIME_WTZ_%d", typmod);
|
||||||
break;
|
break;
|
||||||
case TIMESTAMPOID:
|
case TIMESTAMPOID:
|
||||||
if (typmod == -1)
|
if (typmod == -1)
|
||||||
appendStringInfo(&result, "TIMESTAMP");
|
appendStringInfoString(&result, "TIMESTAMP");
|
||||||
else
|
else
|
||||||
appendStringInfo(&result, "TIMESTAMP_%d", typmod);
|
appendStringInfo(&result, "TIMESTAMP_%d", typmod);
|
||||||
break;
|
break;
|
||||||
case TIMESTAMPTZOID:
|
case TIMESTAMPTZOID:
|
||||||
if (typmod == -1)
|
if (typmod == -1)
|
||||||
appendStringInfo(&result, "TIMESTAMP_WTZ");
|
appendStringInfoString(&result, "TIMESTAMP_WTZ");
|
||||||
else
|
else
|
||||||
appendStringInfo(&result, "TIMESTAMP_WTZ_%d", typmod);
|
appendStringInfo(&result, "TIMESTAMP_WTZ_%d", typmod);
|
||||||
break;
|
break;
|
||||||
case DATEOID:
|
case DATEOID:
|
||||||
appendStringInfo(&result, "DATE");
|
appendStringInfoString(&result, "DATE");
|
||||||
break;
|
break;
|
||||||
case XMLOID:
|
case XMLOID:
|
||||||
appendStringInfo(&result, "XML");
|
appendStringInfoString(&result, "XML");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
@ -3370,7 +3370,7 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod)
|
|||||||
|
|
||||||
if (typeoid == XMLOID)
|
if (typeoid == XMLOID)
|
||||||
{
|
{
|
||||||
appendStringInfo(&result,
|
appendStringInfoString(&result,
|
||||||
"<xsd:complexType mixed=\"true\">\n"
|
"<xsd:complexType mixed=\"true\">\n"
|
||||||
" <xsd:sequence>\n"
|
" <xsd:sequence>\n"
|
||||||
" <xsd:any name=\"element\" minOccurs=\"0\" maxOccurs=\"unbounded\" processContents=\"skip\"/>\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,
|
appendStringInfo(&result,
|
||||||
" <xsd:maxLength value=\"%d\"/>\n",
|
" <xsd:maxLength value=\"%d\"/>\n",
|
||||||
typmod - VARHDRSZ);
|
typmod - VARHDRSZ);
|
||||||
appendStringInfo(&result,
|
appendStringInfoString(&result, " </xsd:restriction>\n");
|
||||||
" </xsd:restriction>\n");
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BYTEAOID:
|
case BYTEAOID:
|
||||||
@ -3444,17 +3443,17 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod)
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case FLOAT4OID:
|
case FLOAT4OID:
|
||||||
appendStringInfo(&result,
|
appendStringInfoString(&result,
|
||||||
" <xsd:restriction base=\"xsd:float\"></xsd:restriction>\n");
|
" <xsd:restriction base=\"xsd:float\"></xsd:restriction>\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case FLOAT8OID:
|
case FLOAT8OID:
|
||||||
appendStringInfo(&result,
|
appendStringInfoString(&result,
|
||||||
" <xsd:restriction base=\"xsd:double\"></xsd:restriction>\n");
|
" <xsd:restriction base=\"xsd:double\"></xsd:restriction>\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case BOOLOID:
|
case BOOLOID:
|
||||||
appendStringInfo(&result,
|
appendStringInfoString(&result,
|
||||||
" <xsd:restriction base=\"xsd:boolean\"></xsd:restriction>\n");
|
" <xsd:restriction base=\"xsd:boolean\"></xsd:restriction>\n");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -3505,7 +3504,7 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod)
|
|||||||
}
|
}
|
||||||
|
|
||||||
case DATEOID:
|
case DATEOID:
|
||||||
appendStringInfo(&result,
|
appendStringInfoString(&result,
|
||||||
" <xsd:restriction base=\"xsd:date\">\n"
|
" <xsd:restriction base=\"xsd:date\">\n"
|
||||||
" <xsd:pattern value=\"\\p{Nd}{4}-\\p{Nd}{2}-\\p{Nd}{2}\"/>\n"
|
" <xsd:pattern value=\"\\p{Nd}{4}-\\p{Nd}{2}-\\p{Nd}{2}\"/>\n"
|
||||||
" </xsd:restriction>\n");
|
" </xsd:restriction>\n");
|
||||||
@ -3525,8 +3524,7 @@ map_sql_type_to_xmlschema_type(Oid typeoid, int typmod)
|
|||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
appendStringInfo(&result,
|
appendStringInfoString(&result, "</xsd:simpleType>\n");
|
||||||
"</xsd:simpleType>\n");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return result.data;
|
return result.data;
|
||||||
|
@ -372,7 +372,7 @@ incompatible_module_error(const char *libname,
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (details.len == 0)
|
if (details.len == 0)
|
||||||
appendStringInfo(&details,
|
appendStringInfoString(&details,
|
||||||
_("Magic block has unexpected length or padding difference."));
|
_("Magic block has unexpected length or padding difference."));
|
||||||
|
|
||||||
ereport(ERROR,
|
ereport(ERROR,
|
||||||
|
@ -6187,7 +6187,7 @@ flatten_set_variable_args(const char *name, List *args)
|
|||||||
A_Const *con;
|
A_Const *con;
|
||||||
|
|
||||||
if (l != list_head(args))
|
if (l != list_head(args))
|
||||||
appendStringInfo(&buf, ", ");
|
appendStringInfoString(&buf, ", ");
|
||||||
|
|
||||||
if (IsA(arg, TypeCast))
|
if (IsA(arg, TypeCast))
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user