aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/explain.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/commands/explain.c')
-rw-r--r--src/backend/commands/explain.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index aa54c1b2f55..f53c8d52e5b 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -1136,7 +1136,8 @@ ExplainNode(PlanState *planstate, List *ancestors,
explain_get_index_name(bitmapindexscan->indexid);
if (es->format == EXPLAIN_FORMAT_TEXT)
- appendStringInfo(es->str, " on %s", indexname);
+ appendStringInfo(es->str, " on %s",
+ quote_identifier(indexname));
else
ExplainPropertyText("Index Name", indexname, es);
}
@@ -2327,6 +2328,10 @@ show_foreignscan_info(ForeignScanState *fsstate, ExplainState *es)
*
* We allow plugins to get control here so that plans involving hypothetical
* indexes can be explained.
+ *
+ * Note: names returned by this function should be "raw"; the caller will
+ * apply quoting if needed. Formerly the convention was to do quoting here,
+ * but we don't want that in non-text output formats.
*/
static const char *
explain_get_index_name(Oid indexId)
@@ -2339,11 +2344,10 @@ explain_get_index_name(Oid indexId)
result = NULL;
if (result == NULL)
{
- /* default behavior: look in the catalogs and quote it */
+ /* default behavior: look it up in the catalogs */
result = get_rel_name(indexId);
if (result == NULL)
elog(ERROR, "cache lookup failed for index %u", indexId);
- result = quote_identifier(result);
}
return result;
}
@@ -2361,7 +2365,7 @@ ExplainIndexScanDetails(Oid indexid, ScanDirection indexorderdir,
{
if (ScanDirectionIsBackward(indexorderdir))
appendStringInfoString(es->str, " Backward");
- appendStringInfo(es->str, " using %s", indexname);
+ appendStringInfo(es->str, " using %s", quote_identifier(indexname));
}
else
{