summaryrefslogtreecommitdiff
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.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 92969636b75..73178dafaf5 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -616,17 +616,11 @@ ExplainPrintSettings(ExplainState *es)
/* request an array of relevant settings */
gucs = get_explain_guc_options(&num);
- /* also bail out of there are no options */
- if (!num)
- return;
-
if (es->format != EXPLAIN_FORMAT_TEXT)
{
- int i;
-
ExplainOpenGroup("Settings", "Settings", true, es);
- for (i = 0; i < num; i++)
+ for (int i = 0; i < num; i++)
{
char *setting;
struct config_generic *conf = gucs[i];
@@ -640,12 +634,15 @@ ExplainPrintSettings(ExplainState *es)
}
else
{
- int i;
StringInfoData str;
+ /* In TEXT mode, print nothing if there are no options */
+ if (num <= 0)
+ return;
+
initStringInfo(&str);
- for (i = 0; i < num; i++)
+ for (int i = 0; i < num; i++)
{
char *setting;
struct config_generic *conf = gucs[i];
@@ -661,8 +658,7 @@ ExplainPrintSettings(ExplainState *es)
appendStringInfo(&str, "%s = NULL", conf->name);
}
- if (num > 0)
- ExplainPropertyText("Settings", str.data, es);
+ ExplainPropertyText("Settings", str.data, es);
}
}