Fixup some appendStringInfo and appendPQExpBuffer calls
A number of places were using appendStringInfo() when they could have been using appendStringInfoString() instead. While there's no functionality change there, it's just more efficient to use appendStringInfoString() when no formatting is required. Likewise for some appendStringInfoString() calls which were just appending a single char. We can just use appendStringInfoChar() for that. Additionally, many places were using appendPQExpBuffer() when they could have used appendPQExpBufferStr(). Change those too. Patch by Zhijie Hou, but further searching by me found significantly more places that deserved the same treatment. Author: Zhijie Hou, David Rowley Discussion: https://postgr.es/m/cb172cf4361e4c7ba7167429070979d4@G08CNEXMBPEKD05.g08.fujitsu.local
This commit is contained in:
parent
73c381cee7
commit
110d81728a
@ -2591,7 +2591,7 @@ postgresExplainForeignScan(ForeignScanState *node, ExplainState *es)
|
|||||||
quote_identifier(relname));
|
quote_identifier(relname));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
appendStringInfo(relations, "%s",
|
appendStringInfoString(relations,
|
||||||
quote_identifier(relname));
|
quote_identifier(relname));
|
||||||
refname = (char *) list_nth(es->rtable_names, rti - 1);
|
refname = (char *) list_nth(es->rtable_names, rti - 1);
|
||||||
if (refname == NULL)
|
if (refname == NULL)
|
||||||
|
@ -606,7 +606,7 @@ pg_output_stream_start(LogicalDecodingContext *ctx, TestDecodingData *data, Reor
|
|||||||
if (data->include_xids)
|
if (data->include_xids)
|
||||||
appendStringInfo(ctx->out, "opening a streamed block for transaction TXN %u", txn->xid);
|
appendStringInfo(ctx->out, "opening a streamed block for transaction TXN %u", txn->xid);
|
||||||
else
|
else
|
||||||
appendStringInfo(ctx->out, "opening a streamed block for transaction");
|
appendStringInfoString(ctx->out, "opening a streamed block for transaction");
|
||||||
OutputPluginWrite(ctx, last_write);
|
OutputPluginWrite(ctx, last_write);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -623,7 +623,7 @@ pg_decode_stream_stop(LogicalDecodingContext *ctx,
|
|||||||
if (data->include_xids)
|
if (data->include_xids)
|
||||||
appendStringInfo(ctx->out, "closing a streamed block for transaction TXN %u", txn->xid);
|
appendStringInfo(ctx->out, "closing a streamed block for transaction TXN %u", txn->xid);
|
||||||
else
|
else
|
||||||
appendStringInfo(ctx->out, "closing a streamed block for transaction");
|
appendStringInfoString(ctx->out, "closing a streamed block for transaction");
|
||||||
OutputPluginWrite(ctx, true);
|
OutputPluginWrite(ctx, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -641,7 +641,7 @@ pg_decode_stream_abort(LogicalDecodingContext *ctx,
|
|||||||
if (data->include_xids)
|
if (data->include_xids)
|
||||||
appendStringInfo(ctx->out, "aborting streamed (sub)transaction TXN %u", txn->xid);
|
appendStringInfo(ctx->out, "aborting streamed (sub)transaction TXN %u", txn->xid);
|
||||||
else
|
else
|
||||||
appendStringInfo(ctx->out, "aborting streamed (sub)transaction");
|
appendStringInfoString(ctx->out, "aborting streamed (sub)transaction");
|
||||||
OutputPluginWrite(ctx, true);
|
OutputPluginWrite(ctx, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -660,7 +660,7 @@ pg_decode_stream_commit(LogicalDecodingContext *ctx,
|
|||||||
if (data->include_xids)
|
if (data->include_xids)
|
||||||
appendStringInfo(ctx->out, "committing streamed transaction TXN %u", txn->xid);
|
appendStringInfo(ctx->out, "committing streamed transaction TXN %u", txn->xid);
|
||||||
else
|
else
|
||||||
appendStringInfo(ctx->out, "committing streamed transaction");
|
appendStringInfoString(ctx->out, "committing streamed transaction");
|
||||||
|
|
||||||
if (data->include_timestamp)
|
if (data->include_timestamp)
|
||||||
appendStringInfo(ctx->out, " (at %s)",
|
appendStringInfo(ctx->out, " (at %s)",
|
||||||
@ -693,7 +693,7 @@ pg_decode_stream_change(LogicalDecodingContext *ctx,
|
|||||||
if (data->include_xids)
|
if (data->include_xids)
|
||||||
appendStringInfo(ctx->out, "streaming change for TXN %u", txn->xid);
|
appendStringInfo(ctx->out, "streaming change for TXN %u", txn->xid);
|
||||||
else
|
else
|
||||||
appendStringInfo(ctx->out, "streaming change for transaction");
|
appendStringInfoString(ctx->out, "streaming change for transaction");
|
||||||
OutputPluginWrite(ctx, true);
|
OutputPluginWrite(ctx, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -745,6 +745,6 @@ pg_decode_stream_truncate(LogicalDecodingContext *ctx, ReorderBufferTXN *txn,
|
|||||||
if (data->include_xids)
|
if (data->include_xids)
|
||||||
appendStringInfo(ctx->out, "streaming truncate for TXN %u", txn->xid);
|
appendStringInfo(ctx->out, "streaming truncate for TXN %u", txn->xid);
|
||||||
else
|
else
|
||||||
appendStringInfo(ctx->out, "streaming truncate for transaction");
|
appendStringInfoString(ctx->out, "streaming truncate for transaction");
|
||||||
OutputPluginWrite(ctx, true);
|
OutputPluginWrite(ctx, true);
|
||||||
}
|
}
|
||||||
|
@ -37,7 +37,7 @@ dbase_desc(StringInfo buf, XLogReaderState *record)
|
|||||||
xl_dbase_drop_rec *xlrec = (xl_dbase_drop_rec *) rec;
|
xl_dbase_drop_rec *xlrec = (xl_dbase_drop_rec *) rec;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
appendStringInfo(buf, "dir");
|
appendStringInfoString(buf, "dir");
|
||||||
for (i = 0; i < xlrec->ntablespaces; i++)
|
for (i = 0; i < xlrec->ntablespaces; i++)
|
||||||
appendStringInfo(buf, " %u/%u",
|
appendStringInfo(buf, " %u/%u",
|
||||||
xlrec->tablespace_ids[i], xlrec->db_id);
|
xlrec->tablespace_ids[i], xlrec->db_id);
|
||||||
|
@ -2768,14 +2768,14 @@ show_incremental_sort_group_info(IncrementalSortGroupInfo *groupInfo,
|
|||||||
groupInfo->groupCount);
|
groupInfo->groupCount);
|
||||||
/* plural/singular based on methodNames size */
|
/* plural/singular based on methodNames size */
|
||||||
if (list_length(methodNames) > 1)
|
if (list_length(methodNames) > 1)
|
||||||
appendStringInfo(es->str, "s: ");
|
appendStringInfoString(es->str, "s: ");
|
||||||
else
|
else
|
||||||
appendStringInfo(es->str, ": ");
|
appendStringInfoString(es->str, ": ");
|
||||||
foreach(methodCell, methodNames)
|
foreach(methodCell, methodNames)
|
||||||
{
|
{
|
||||||
appendStringInfo(es->str, "%s", (char *) methodCell->ptr_value);
|
appendStringInfoString(es->str, (char *) methodCell->ptr_value);
|
||||||
if (foreach_current_index(methodCell) < list_length(methodNames) - 1)
|
if (foreach_current_index(methodCell) < list_length(methodNames) - 1)
|
||||||
appendStringInfo(es->str, ", ");
|
appendStringInfoString(es->str, ", ");
|
||||||
}
|
}
|
||||||
|
|
||||||
if (groupInfo->maxMemorySpaceUsed > 0)
|
if (groupInfo->maxMemorySpaceUsed > 0)
|
||||||
@ -2882,11 +2882,11 @@ show_incremental_sort_info(IncrementalSortState *incrsortstate,
|
|||||||
if (prefixsortGroupInfo->groupCount > 0)
|
if (prefixsortGroupInfo->groupCount > 0)
|
||||||
{
|
{
|
||||||
if (es->format == EXPLAIN_FORMAT_TEXT)
|
if (es->format == EXPLAIN_FORMAT_TEXT)
|
||||||
appendStringInfo(es->str, "\n");
|
appendStringInfoChar(es->str, '\n');
|
||||||
show_incremental_sort_group_info(prefixsortGroupInfo, "Pre-sorted", true, es);
|
show_incremental_sort_group_info(prefixsortGroupInfo, "Pre-sorted", true, es);
|
||||||
}
|
}
|
||||||
if (es->format == EXPLAIN_FORMAT_TEXT)
|
if (es->format == EXPLAIN_FORMAT_TEXT)
|
||||||
appendStringInfo(es->str, "\n");
|
appendStringInfoChar(es->str, '\n');
|
||||||
}
|
}
|
||||||
|
|
||||||
if (incrsortstate->shared_info != NULL)
|
if (incrsortstate->shared_info != NULL)
|
||||||
@ -2925,11 +2925,11 @@ show_incremental_sort_info(IncrementalSortState *incrsortstate,
|
|||||||
if (prefixsortGroupInfo->groupCount > 0)
|
if (prefixsortGroupInfo->groupCount > 0)
|
||||||
{
|
{
|
||||||
if (es->format == EXPLAIN_FORMAT_TEXT)
|
if (es->format == EXPLAIN_FORMAT_TEXT)
|
||||||
appendStringInfo(es->str, "\n");
|
appendStringInfoChar(es->str, '\n');
|
||||||
show_incremental_sort_group_info(prefixsortGroupInfo, "Pre-sorted", true, es);
|
show_incremental_sort_group_info(prefixsortGroupInfo, "Pre-sorted", true, es);
|
||||||
}
|
}
|
||||||
if (es->format == EXPLAIN_FORMAT_TEXT)
|
if (es->format == EXPLAIN_FORMAT_TEXT)
|
||||||
appendStringInfo(es->str, "\n");
|
appendStringInfoChar(es->str, '\n');
|
||||||
|
|
||||||
if (es->workers_state)
|
if (es->workers_state)
|
||||||
ExplainCloseWorker(n, es);
|
ExplainCloseWorker(n, es);
|
||||||
|
@ -112,7 +112,7 @@ AddFileToBackupManifest(backup_manifest_info *manifest, const char *spcoid,
|
|||||||
initStringInfo(&buf);
|
initStringInfo(&buf);
|
||||||
if (manifest->first_file)
|
if (manifest->first_file)
|
||||||
{
|
{
|
||||||
appendStringInfoString(&buf, "\n");
|
appendStringInfoChar(&buf, '\n');
|
||||||
manifest->first_file = false;
|
manifest->first_file = false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -152,7 +152,7 @@ AddFileToBackupManifest(backup_manifest_info *manifest, const char *spcoid,
|
|||||||
enlargeStringInfo(&buf, 128);
|
enlargeStringInfo(&buf, 128);
|
||||||
buf.len += pg_strftime(&buf.data[buf.len], 128, "%Y-%m-%d %H:%M:%S %Z",
|
buf.len += pg_strftime(&buf.data[buf.len], 128, "%Y-%m-%d %H:%M:%S %Z",
|
||||||
pg_gmtime(&mtime));
|
pg_gmtime(&mtime));
|
||||||
appendStringInfoString(&buf, "\"");
|
appendStringInfoChar(&buf, '"');
|
||||||
|
|
||||||
/* Add checksum information. */
|
/* Add checksum information. */
|
||||||
if (checksum_ctx->type != CHECKSUM_TYPE_NONE)
|
if (checksum_ctx->type != CHECKSUM_TYPE_NONE)
|
||||||
@ -168,7 +168,7 @@ AddFileToBackupManifest(backup_manifest_info *manifest, const char *spcoid,
|
|||||||
enlargeStringInfo(&buf, 2 * checksumlen);
|
enlargeStringInfo(&buf, 2 * checksumlen);
|
||||||
buf.len += hex_encode((char *) checksumbuf, checksumlen,
|
buf.len += hex_encode((char *) checksumbuf, checksumlen,
|
||||||
&buf.data[buf.len]);
|
&buf.data[buf.len]);
|
||||||
appendStringInfoString(&buf, "\"");
|
appendStringInfoChar(&buf, '"');
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Close out the object. */
|
/* Close out the object. */
|
||||||
|
@ -427,7 +427,7 @@ libpqrcv_startstreaming(WalReceiverConn *conn,
|
|||||||
|
|
||||||
if (options->proto.logical.streaming &&
|
if (options->proto.logical.streaming &&
|
||||||
PQserverVersion(conn->streamConn) >= 140000)
|
PQserverVersion(conn->streamConn) >= 140000)
|
||||||
appendStringInfo(&cmd, ", streaming 'on'");
|
appendStringInfoString(&cmd, ", streaming 'on'");
|
||||||
|
|
||||||
pubnames = options->proto.logical.publication_names;
|
pubnames = options->proto.logical.publication_names;
|
||||||
pubnames_str = stringlist_to_identifierstr(conn->streamConn, pubnames);
|
pubnames_str = stringlist_to_identifierstr(conn->streamConn, pubnames);
|
||||||
|
@ -774,7 +774,7 @@ copy_table(Relation rel)
|
|||||||
* For non-tables, we need to do COPY (SELECT ...), but we can't just
|
* For non-tables, we need to do COPY (SELECT ...), but we can't just
|
||||||
* do SELECT * because we need to not copy generated columns.
|
* do SELECT * because we need to not copy generated columns.
|
||||||
*/
|
*/
|
||||||
appendStringInfo(&cmd, "COPY (SELECT ");
|
appendStringInfoString(&cmd, "COPY (SELECT ");
|
||||||
for (int i = 0; i < lrel.natts; i++)
|
for (int i = 0; i < lrel.natts; i++)
|
||||||
{
|
{
|
||||||
appendStringInfoString(&cmd, quote_identifier(lrel.attnames[i]));
|
appendStringInfoString(&cmd, quote_identifier(lrel.attnames[i]));
|
||||||
|
@ -660,7 +660,7 @@ printJsonPathItem(StringInfo buf, JsonPathItem *v, bool inKey,
|
|||||||
else if (v->content.anybounds.first == v->content.anybounds.last)
|
else if (v->content.anybounds.first == v->content.anybounds.last)
|
||||||
{
|
{
|
||||||
if (v->content.anybounds.first == PG_UINT32_MAX)
|
if (v->content.anybounds.first == PG_UINT32_MAX)
|
||||||
appendStringInfo(buf, "**{last}");
|
appendStringInfoString(buf, "**{last}");
|
||||||
else
|
else
|
||||||
appendStringInfo(buf, "**{%u}",
|
appendStringInfo(buf, "**{%u}",
|
||||||
v->content.anybounds.first);
|
v->content.anybounds.first);
|
||||||
|
@ -1663,7 +1663,7 @@ RI_PartitionRemove_Check(Trigger *trigger, Relation fk_rel, Relation pk_rel)
|
|||||||
appendStringInfo(&querybuf, ") WHERE %s AND (",
|
appendStringInfo(&querybuf, ") WHERE %s AND (",
|
||||||
constraintDef);
|
constraintDef);
|
||||||
else
|
else
|
||||||
appendStringInfo(&querybuf, ") WHERE (");
|
appendStringInfoString(&querybuf, ") WHERE (");
|
||||||
|
|
||||||
sep = "";
|
sep = "";
|
||||||
for (i = 0; i < riinfo->nkeys; i++)
|
for (i = 0; i < riinfo->nkeys; i++)
|
||||||
|
@ -5250,7 +5250,7 @@ get_select_query_def(Query *query, deparse_context *context,
|
|||||||
appendContextKeyword(context, " FETCH FIRST ",
|
appendContextKeyword(context, " FETCH FIRST ",
|
||||||
-PRETTYINDENT_STD, PRETTYINDENT_STD, 0);
|
-PRETTYINDENT_STD, PRETTYINDENT_STD, 0);
|
||||||
get_rule_expr(query->limitCount, context, false);
|
get_rule_expr(query->limitCount, context, false);
|
||||||
appendStringInfo(buf, " ROWS WITH TIES");
|
appendStringInfoString(buf, " ROWS WITH TIES");
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
@ -11362,7 +11362,7 @@ get_range_partbound_string(List *bound_datums)
|
|||||||
memset(&context, 0, sizeof(deparse_context));
|
memset(&context, 0, sizeof(deparse_context));
|
||||||
context.buf = buf;
|
context.buf = buf;
|
||||||
|
|
||||||
appendStringInfoString(buf, "(");
|
appendStringInfoChar(buf, '(');
|
||||||
sep = "";
|
sep = "";
|
||||||
foreach(cell, bound_datums)
|
foreach(cell, bound_datums)
|
||||||
{
|
{
|
||||||
|
@ -1375,7 +1375,7 @@ expand_foreign_server_name_patterns(Archive *fout,
|
|||||||
|
|
||||||
for (cell = patterns->head; cell; cell = cell->next)
|
for (cell = patterns->head; cell; cell = cell->next)
|
||||||
{
|
{
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"SELECT oid FROM pg_catalog.pg_foreign_server s\n");
|
"SELECT oid FROM pg_catalog.pg_foreign_server s\n");
|
||||||
processSQLNamePattern(GetConnection(fout), query, cell->val, false,
|
processSQLNamePattern(GetConnection(fout), query, cell->val, false,
|
||||||
false, NULL, "s.srvname", NULL, NULL);
|
false, NULL, "s.srvname", NULL, NULL);
|
||||||
@ -4250,20 +4250,16 @@ getSubscriptions(Archive *fout)
|
|||||||
username_subquery);
|
username_subquery);
|
||||||
|
|
||||||
if (fout->remoteVersion >= 140000)
|
if (fout->remoteVersion >= 140000)
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query, " s.subbinary,\n");
|
||||||
" s.subbinary,\n");
|
|
||||||
else
|
else
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query, " false AS subbinary,\n");
|
||||||
" false AS subbinary,\n");
|
|
||||||
|
|
||||||
if (fout->remoteVersion >= 140000)
|
if (fout->remoteVersion >= 140000)
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query, " s.substream\n");
|
||||||
" s.substream\n");
|
|
||||||
else
|
else
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query, " false AS substream\n");
|
||||||
" false AS substream\n");
|
|
||||||
|
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"FROM pg_subscription s\n"
|
"FROM pg_subscription s\n"
|
||||||
"WHERE s.subdbid = (SELECT oid FROM pg_database\n"
|
"WHERE s.subdbid = (SELECT oid FROM pg_database\n"
|
||||||
" WHERE datname = current_database())");
|
" WHERE datname = current_database())");
|
||||||
@ -4376,10 +4372,10 @@ dumpSubscription(Archive *fout, SubscriptionInfo *subinfo)
|
|||||||
appendPQExpBufferStr(query, "NONE");
|
appendPQExpBufferStr(query, "NONE");
|
||||||
|
|
||||||
if (strcmp(subinfo->subbinary, "t") == 0)
|
if (strcmp(subinfo->subbinary, "t") == 0)
|
||||||
appendPQExpBuffer(query, ", binary = true");
|
appendPQExpBufferStr(query, ", binary = true");
|
||||||
|
|
||||||
if (strcmp(subinfo->substream, "f") != 0)
|
if (strcmp(subinfo->substream, "f") != 0)
|
||||||
appendPQExpBuffer(query, ", streaming = on");
|
appendPQExpBufferStr(query, ", streaming = on");
|
||||||
|
|
||||||
if (strcmp(subinfo->subsynccommit, "off") != 0)
|
if (strcmp(subinfo->subsynccommit, "off") != 0)
|
||||||
appendPQExpBuffer(query, ", synchronous_commit = %s", fmtId(subinfo->subsynccommit));
|
appendPQExpBuffer(query, ", synchronous_commit = %s", fmtId(subinfo->subsynccommit));
|
||||||
@ -11845,7 +11841,7 @@ dumpFunc(Archive *fout, FuncInfo *finfo)
|
|||||||
asPart = createPQExpBuffer();
|
asPart = createPQExpBuffer();
|
||||||
|
|
||||||
/* Fetch function-specific details */
|
/* Fetch function-specific details */
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"SELECT\n"
|
"SELECT\n"
|
||||||
"proretset,\n"
|
"proretset,\n"
|
||||||
"prosrc,\n"
|
"prosrc,\n"
|
||||||
@ -11856,12 +11852,12 @@ dumpFunc(Archive *fout, FuncInfo *finfo)
|
|||||||
"(SELECT lanname FROM pg_catalog.pg_language WHERE oid = prolang) AS lanname,\n");
|
"(SELECT lanname FROM pg_catalog.pg_language WHERE oid = prolang) AS lanname,\n");
|
||||||
|
|
||||||
if (fout->remoteVersion >= 80300)
|
if (fout->remoteVersion >= 80300)
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"proconfig,\n"
|
"proconfig,\n"
|
||||||
"procost,\n"
|
"procost,\n"
|
||||||
"prorows,\n");
|
"prorows,\n");
|
||||||
else
|
else
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"null AS proconfig,\n"
|
"null AS proconfig,\n"
|
||||||
"0 AS procost,\n"
|
"0 AS procost,\n"
|
||||||
"0 AS prorows,\n");
|
"0 AS prorows,\n");
|
||||||
@ -11872,55 +11868,55 @@ dumpFunc(Archive *fout, FuncInfo *finfo)
|
|||||||
* In 8.4 and up we rely on pg_get_function_arguments and
|
* In 8.4 and up we rely on pg_get_function_arguments and
|
||||||
* pg_get_function_result instead of examining proallargtypes etc.
|
* pg_get_function_result instead of examining proallargtypes etc.
|
||||||
*/
|
*/
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"pg_catalog.pg_get_function_arguments(oid) AS funcargs,\n"
|
"pg_catalog.pg_get_function_arguments(oid) AS funcargs,\n"
|
||||||
"pg_catalog.pg_get_function_identity_arguments(oid) AS funciargs,\n"
|
"pg_catalog.pg_get_function_identity_arguments(oid) AS funciargs,\n"
|
||||||
"pg_catalog.pg_get_function_result(oid) AS funcresult,\n");
|
"pg_catalog.pg_get_function_result(oid) AS funcresult,\n");
|
||||||
}
|
}
|
||||||
else if (fout->remoteVersion >= 80100)
|
else if (fout->remoteVersion >= 80100)
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"proallargtypes,\n"
|
"proallargtypes,\n"
|
||||||
"proargmodes,\n"
|
"proargmodes,\n"
|
||||||
"proargnames,\n");
|
"proargnames,\n");
|
||||||
else
|
else
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"null AS proallargtypes,\n"
|
"null AS proallargtypes,\n"
|
||||||
"null AS proargmodes,\n"
|
"null AS proargmodes,\n"
|
||||||
"proargnames,\n");
|
"proargnames,\n");
|
||||||
|
|
||||||
if (fout->remoteVersion >= 90200)
|
if (fout->remoteVersion >= 90200)
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"proleakproof,\n");
|
"proleakproof,\n");
|
||||||
else
|
else
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"false AS proleakproof,\n");
|
"false AS proleakproof,\n");
|
||||||
|
|
||||||
if (fout->remoteVersion >= 90500)
|
if (fout->remoteVersion >= 90500)
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"array_to_string(protrftypes, ' ') AS protrftypes,\n");
|
"array_to_string(protrftypes, ' ') AS protrftypes,\n");
|
||||||
|
|
||||||
if (fout->remoteVersion >= 90600)
|
if (fout->remoteVersion >= 90600)
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"proparallel,\n");
|
"proparallel,\n");
|
||||||
else
|
else
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"'u' AS proparallel,\n");
|
"'u' AS proparallel,\n");
|
||||||
|
|
||||||
if (fout->remoteVersion >= 110000)
|
if (fout->remoteVersion >= 110000)
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"prokind,\n");
|
"prokind,\n");
|
||||||
else if (fout->remoteVersion >= 80400)
|
else if (fout->remoteVersion >= 80400)
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"CASE WHEN proiswindow THEN 'w' ELSE 'f' END AS prokind,\n");
|
"CASE WHEN proiswindow THEN 'w' ELSE 'f' END AS prokind,\n");
|
||||||
else
|
else
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"'f' AS prokind,\n");
|
"'f' AS prokind,\n");
|
||||||
|
|
||||||
if (fout->remoteVersion >= 120000)
|
if (fout->remoteVersion >= 120000)
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"prosupport\n");
|
"prosupport\n");
|
||||||
else
|
else
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"'-' AS prosupport\n");
|
"'-' AS prosupport\n");
|
||||||
|
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBuffer(query,
|
||||||
@ -13891,7 +13887,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
|
|||||||
details = createPQExpBuffer();
|
details = createPQExpBuffer();
|
||||||
|
|
||||||
/* Get aggregate-specific details */
|
/* Get aggregate-specific details */
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"SELECT\n"
|
"SELECT\n"
|
||||||
"aggtransfn,\n"
|
"aggtransfn,\n"
|
||||||
"aggfinalfn,\n"
|
"aggfinalfn,\n"
|
||||||
@ -13899,19 +13895,19 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
|
|||||||
"agginitval,\n");
|
"agginitval,\n");
|
||||||
|
|
||||||
if (fout->remoteVersion >= 80100)
|
if (fout->remoteVersion >= 80100)
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"aggsortop,\n");
|
"aggsortop,\n");
|
||||||
else
|
else
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"0 AS aggsortop,\n");
|
"0 AS aggsortop,\n");
|
||||||
|
|
||||||
if (fout->remoteVersion >= 80400)
|
if (fout->remoteVersion >= 80400)
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"pg_catalog.pg_get_function_arguments(p.oid) AS funcargs,\n"
|
"pg_catalog.pg_get_function_arguments(p.oid) AS funcargs,\n"
|
||||||
"pg_catalog.pg_get_function_identity_arguments(p.oid) AS funciargs,\n");
|
"pg_catalog.pg_get_function_identity_arguments(p.oid) AS funciargs,\n");
|
||||||
|
|
||||||
if (fout->remoteVersion >= 90400)
|
if (fout->remoteVersion >= 90400)
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"aggkind,\n"
|
"aggkind,\n"
|
||||||
"aggmtransfn,\n"
|
"aggmtransfn,\n"
|
||||||
"aggminvtransfn,\n"
|
"aggminvtransfn,\n"
|
||||||
@ -13923,7 +13919,7 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
|
|||||||
"aggmtransspace,\n"
|
"aggmtransspace,\n"
|
||||||
"aggminitval,\n");
|
"aggminitval,\n");
|
||||||
else
|
else
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"'n' AS aggkind,\n"
|
"'n' AS aggkind,\n"
|
||||||
"'-' AS aggmtransfn,\n"
|
"'-' AS aggmtransfn,\n"
|
||||||
"'-' AS aggminvtransfn,\n"
|
"'-' AS aggminvtransfn,\n"
|
||||||
@ -13936,24 +13932,24 @@ dumpAgg(Archive *fout, AggInfo *agginfo)
|
|||||||
"NULL AS aggminitval,\n");
|
"NULL AS aggminitval,\n");
|
||||||
|
|
||||||
if (fout->remoteVersion >= 90600)
|
if (fout->remoteVersion >= 90600)
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"aggcombinefn,\n"
|
"aggcombinefn,\n"
|
||||||
"aggserialfn,\n"
|
"aggserialfn,\n"
|
||||||
"aggdeserialfn,\n"
|
"aggdeserialfn,\n"
|
||||||
"proparallel,\n");
|
"proparallel,\n");
|
||||||
else
|
else
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"'-' AS aggcombinefn,\n"
|
"'-' AS aggcombinefn,\n"
|
||||||
"'-' AS aggserialfn,\n"
|
"'-' AS aggserialfn,\n"
|
||||||
"'-' AS aggdeserialfn,\n"
|
"'-' AS aggdeserialfn,\n"
|
||||||
"'u' AS proparallel,\n");
|
"'u' AS proparallel,\n");
|
||||||
|
|
||||||
if (fout->remoteVersion >= 110000)
|
if (fout->remoteVersion >= 110000)
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"aggfinalmodify,\n"
|
"aggfinalmodify,\n"
|
||||||
"aggmfinalmodify\n");
|
"aggmfinalmodify\n");
|
||||||
else
|
else
|
||||||
appendPQExpBuffer(query,
|
appendPQExpBufferStr(query,
|
||||||
"'0' AS aggfinalmodify,\n"
|
"'0' AS aggfinalmodify,\n"
|
||||||
"'0' AS aggmfinalmodify\n");
|
"'0' AS aggmfinalmodify\n");
|
||||||
|
|
||||||
|
@ -158,13 +158,13 @@ check_for_data_type_usage(ClusterInfo *cluster, const char *typename,
|
|||||||
|
|
||||||
/* Ranges were introduced in 9.2 */
|
/* Ranges were introduced in 9.2 */
|
||||||
if (GET_MAJOR_VERSION(cluster->major_version) >= 902)
|
if (GET_MAJOR_VERSION(cluster->major_version) >= 902)
|
||||||
appendPQExpBuffer(&querybuf,
|
appendPQExpBufferStr(&querybuf,
|
||||||
" UNION ALL "
|
" UNION ALL "
|
||||||
/* ranges containing any type selected so far */
|
/* ranges containing any type selected so far */
|
||||||
" SELECT t.oid FROM pg_catalog.pg_type t, pg_catalog.pg_range r, x "
|
" SELECT t.oid FROM pg_catalog.pg_type t, pg_catalog.pg_range r, x "
|
||||||
" WHERE t.typtype = 'r' AND r.rngtypid = t.oid AND r.rngsubtype = x.oid");
|
" WHERE t.typtype = 'r' AND r.rngtypid = t.oid AND r.rngsubtype = x.oid");
|
||||||
|
|
||||||
appendPQExpBuffer(&querybuf,
|
appendPQExpBufferStr(&querybuf,
|
||||||
" ) foo "
|
" ) foo "
|
||||||
") "
|
") "
|
||||||
/* now look for stored columns of any such type */
|
/* now look for stored columns of any such type */
|
||||||
|
@ -6137,15 +6137,14 @@ listOperatorClasses(const char *access_method_pattern,
|
|||||||
" pg_catalog.pg_get_userbyid(c.opcowner) AS \"%s\"\n",
|
" pg_catalog.pg_get_userbyid(c.opcowner) AS \"%s\"\n",
|
||||||
gettext_noop("Operator family"),
|
gettext_noop("Operator family"),
|
||||||
gettext_noop("Owner"));
|
gettext_noop("Owner"));
|
||||||
appendPQExpBuffer(&buf,
|
appendPQExpBufferStr(&buf,
|
||||||
"\nFROM pg_catalog.pg_opclass c\n"
|
"\nFROM pg_catalog.pg_opclass c\n"
|
||||||
" LEFT JOIN pg_catalog.pg_am am on am.oid = c.opcmethod\n"
|
" LEFT JOIN pg_catalog.pg_am am on am.oid = c.opcmethod\n"
|
||||||
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.opcnamespace\n"
|
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = c.opcnamespace\n"
|
||||||
" LEFT JOIN pg_catalog.pg_type t ON t.oid = c.opcintype\n"
|
" LEFT JOIN pg_catalog.pg_type t ON t.oid = c.opcintype\n"
|
||||||
" LEFT JOIN pg_catalog.pg_namespace tn ON tn.oid = t.typnamespace\n"
|
" LEFT JOIN pg_catalog.pg_namespace tn ON tn.oid = t.typnamespace\n");
|
||||||
);
|
|
||||||
if (verbose)
|
if (verbose)
|
||||||
appendPQExpBuffer(&buf,
|
appendPQExpBufferStr(&buf,
|
||||||
" LEFT JOIN pg_catalog.pg_opfamily of ON of.oid = c.opcfamily\n"
|
" LEFT JOIN pg_catalog.pg_opfamily of ON of.oid = c.opcfamily\n"
|
||||||
" LEFT JOIN pg_catalog.pg_namespace ofn ON ofn.oid = of.opfnamespace\n");
|
" LEFT JOIN pg_catalog.pg_namespace ofn ON ofn.oid = of.opfnamespace\n");
|
||||||
|
|
||||||
@ -6216,11 +6215,10 @@ listOperatorFamilies(const char *access_method_pattern,
|
|||||||
appendPQExpBuffer(&buf,
|
appendPQExpBuffer(&buf,
|
||||||
",\n pg_catalog.pg_get_userbyid(f.opfowner) AS \"%s\"\n",
|
",\n pg_catalog.pg_get_userbyid(f.opfowner) AS \"%s\"\n",
|
||||||
gettext_noop("Owner"));
|
gettext_noop("Owner"));
|
||||||
appendPQExpBuffer(&buf,
|
appendPQExpBufferStr(&buf,
|
||||||
"\nFROM pg_catalog.pg_opfamily f\n"
|
"\nFROM pg_catalog.pg_opfamily f\n"
|
||||||
" LEFT JOIN pg_catalog.pg_am am on am.oid = f.opfmethod\n"
|
" LEFT JOIN pg_catalog.pg_am am on am.oid = f.opfmethod\n"
|
||||||
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = f.opfnamespace\n"
|
" LEFT JOIN pg_catalog.pg_namespace n ON n.oid = f.opfnamespace\n");
|
||||||
);
|
|
||||||
|
|
||||||
if (access_method_pattern)
|
if (access_method_pattern)
|
||||||
have_where = processSQLNamePattern(pset.db, &buf, access_method_pattern,
|
have_where = processSQLNamePattern(pset.db, &buf, access_method_pattern,
|
||||||
@ -6240,7 +6238,7 @@ listOperatorFamilies(const char *access_method_pattern,
|
|||||||
"tn.nspname", "t.typname",
|
"tn.nspname", "t.typname",
|
||||||
"pg_catalog.format_type(t.oid, NULL)",
|
"pg_catalog.format_type(t.oid, NULL)",
|
||||||
"pg_catalog.pg_type_is_visible(t.oid)");
|
"pg_catalog.pg_type_is_visible(t.oid)");
|
||||||
appendPQExpBuffer(&buf, " )\n");
|
appendPQExpBufferStr(&buf, " )\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
appendPQExpBufferStr(&buf, "ORDER BY 1, 2;");
|
appendPQExpBufferStr(&buf, "ORDER BY 1, 2;");
|
||||||
@ -6307,13 +6305,13 @@ listOpFamilyOperators(const char *access_method_pattern,
|
|||||||
appendPQExpBuffer(&buf,
|
appendPQExpBuffer(&buf,
|
||||||
", ofs.opfname AS \"%s\"\n",
|
", ofs.opfname AS \"%s\"\n",
|
||||||
gettext_noop("Sort opfamily"));
|
gettext_noop("Sort opfamily"));
|
||||||
appendPQExpBuffer(&buf,
|
appendPQExpBufferStr(&buf,
|
||||||
"FROM pg_catalog.pg_amop o\n"
|
"FROM pg_catalog.pg_amop o\n"
|
||||||
" LEFT JOIN pg_catalog.pg_opfamily of ON of.oid = o.amopfamily\n"
|
" LEFT JOIN pg_catalog.pg_opfamily of ON of.oid = o.amopfamily\n"
|
||||||
" LEFT JOIN pg_catalog.pg_am am ON am.oid = of.opfmethod AND am.oid = o.amopmethod\n"
|
" LEFT JOIN pg_catalog.pg_am am ON am.oid = of.opfmethod AND am.oid = o.amopmethod\n"
|
||||||
" LEFT JOIN pg_catalog.pg_namespace nsf ON of.opfnamespace = nsf.oid\n");
|
" LEFT JOIN pg_catalog.pg_namespace nsf ON of.opfnamespace = nsf.oid\n");
|
||||||
if (verbose)
|
if (verbose)
|
||||||
appendPQExpBuffer(&buf,
|
appendPQExpBufferStr(&buf,
|
||||||
" LEFT JOIN pg_catalog.pg_opfamily ofs ON ofs.oid = o.amopsortfamily\n");
|
" LEFT JOIN pg_catalog.pg_opfamily ofs ON ofs.oid = o.amopsortfamily\n");
|
||||||
|
|
||||||
if (access_method_pattern)
|
if (access_method_pattern)
|
||||||
@ -6393,7 +6391,7 @@ listOpFamilyFunctions(const char *access_method_pattern,
|
|||||||
", ap.amproc::pg_catalog.regprocedure AS \"%s\"\n",
|
", ap.amproc::pg_catalog.regprocedure AS \"%s\"\n",
|
||||||
gettext_noop("Function"));
|
gettext_noop("Function"));
|
||||||
|
|
||||||
appendPQExpBuffer(&buf,
|
appendPQExpBufferStr(&buf,
|
||||||
"FROM pg_catalog.pg_amproc ap\n"
|
"FROM pg_catalog.pg_amproc ap\n"
|
||||||
" LEFT JOIN pg_catalog.pg_opfamily of ON of.oid = ap.amprocfamily\n"
|
" LEFT JOIN pg_catalog.pg_opfamily of ON of.oid = ap.amprocfamily\n"
|
||||||
" LEFT JOIN pg_catalog.pg_am am ON am.oid = of.opfmethod\n"
|
" LEFT JOIN pg_catalog.pg_am am ON am.oid = of.opfmethod\n"
|
||||||
|
@ -614,7 +614,7 @@ get_parallel_object_list(PGconn *conn, ReindexType type,
|
|||||||
{
|
{
|
||||||
case REINDEX_DATABASE:
|
case REINDEX_DATABASE:
|
||||||
Assert(user_list == NULL);
|
Assert(user_list == NULL);
|
||||||
appendPQExpBuffer(&catalog_query,
|
appendPQExpBufferStr(&catalog_query,
|
||||||
"SELECT c.relname, ns.nspname\n"
|
"SELECT c.relname, ns.nspname\n"
|
||||||
" FROM pg_catalog.pg_class c\n"
|
" FROM pg_catalog.pg_class c\n"
|
||||||
" JOIN pg_catalog.pg_namespace ns"
|
" JOIN pg_catalog.pg_namespace ns"
|
||||||
@ -637,7 +637,7 @@ get_parallel_object_list(PGconn *conn, ReindexType type,
|
|||||||
* All the tables from all the listed schemas are grabbed at
|
* All the tables from all the listed schemas are grabbed at
|
||||||
* once.
|
* once.
|
||||||
*/
|
*/
|
||||||
appendPQExpBuffer(&catalog_query,
|
appendPQExpBufferStr(&catalog_query,
|
||||||
"SELECT c.relname, ns.nspname\n"
|
"SELECT c.relname, ns.nspname\n"
|
||||||
" FROM pg_catalog.pg_class c\n"
|
" FROM pg_catalog.pg_class c\n"
|
||||||
" JOIN pg_catalog.pg_namespace ns"
|
" JOIN pg_catalog.pg_namespace ns"
|
||||||
@ -652,14 +652,14 @@ get_parallel_object_list(PGconn *conn, ReindexType type,
|
|||||||
const char *nspname = cell->val;
|
const char *nspname = cell->val;
|
||||||
|
|
||||||
if (nsp_listed)
|
if (nsp_listed)
|
||||||
appendPQExpBuffer(&catalog_query, ", ");
|
appendPQExpBufferStr(&catalog_query, ", ");
|
||||||
else
|
else
|
||||||
nsp_listed = true;
|
nsp_listed = true;
|
||||||
|
|
||||||
appendStringLiteralConn(&catalog_query, nspname, conn);
|
appendStringLiteralConn(&catalog_query, nspname, conn);
|
||||||
}
|
}
|
||||||
|
|
||||||
appendPQExpBuffer(&catalog_query, ")\n"
|
appendPQExpBufferStr(&catalog_query, ")\n"
|
||||||
" ORDER BY c.relpages DESC;");
|
" ORDER BY c.relpages DESC;");
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
@ -216,7 +216,7 @@ PLy_traceback(PyObject *e, PyObject *v, PyObject *tb,
|
|||||||
else if (strcmp(e_module_s, "builtins") == 0
|
else if (strcmp(e_module_s, "builtins") == 0
|
||||||
|| strcmp(e_module_s, "__main__") == 0
|
|| strcmp(e_module_s, "__main__") == 0
|
||||||
|| strcmp(e_module_s, "exceptions") == 0)
|
|| strcmp(e_module_s, "exceptions") == 0)
|
||||||
appendStringInfo(&xstr, "%s", e_type_s);
|
appendStringInfoString(&xstr, e_type_s);
|
||||||
else
|
else
|
||||||
appendStringInfo(&xstr, "%s.%s", e_module_s, e_type_s);
|
appendStringInfo(&xstr, "%s.%s", e_module_s, e_type_s);
|
||||||
appendStringInfo(&xstr, ": %s", vstr);
|
appendStringInfo(&xstr, ": %s", vstr);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user