aboutsummaryrefslogtreecommitdiff
path: root/src/backend/commands/explain.c
diff options
context:
space:
mode:
authorAlvaro Herrera <alvherre@alvh.no-ip.org>2022-05-18 21:20:49 +0200
committerAlvaro Herrera <alvherre@alvh.no-ip.org>2022-05-18 21:20:49 +0200
commit12e423e21d8ef47d95a099c12f625f6d191eaf92 (patch)
tree2eff4e84be1c22c68a3745f51bab4e16a716921c /src/backend/commands/explain.c
parent0fbf0112002355efb2bb525ab88edf891dbfd033 (diff)
downloadpostgresql-12e423e21d8ef47d95a099c12f625f6d191eaf92.tar.gz
postgresql-12e423e21d8ef47d95a099c12f625f6d191eaf92.zip
Fix EXPLAIN MERGE output when no tuples are processed
An 'else' clause was misplaced in commit 598ac10be1c2, making zero-rows output look a bit silly. Add a test case for it. Pointed out by Tom Lane. Discussion: https://postgr.es/m/21030.1652893083@sss.pgh.pa.us
Diffstat (limited to 'src/backend/commands/explain.c')
-rw-r--r--src/backend/commands/explain.c27
1 files changed, 15 insertions, 12 deletions
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 2de546f16eb..5d1f7089daf 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -4068,19 +4068,22 @@ show_modifytable_info(ModifyTableState *mtstate, List *ancestors,
skipped_path = total - insert_path - update_path - delete_path;
Assert(skipped_path >= 0);
- if (es->format == EXPLAIN_FORMAT_TEXT && total > 0)
+ if (es->format == EXPLAIN_FORMAT_TEXT)
{
- ExplainIndentText(es);
- appendStringInfoString(es->str, "Tuples:");
- if (insert_path > 0)
- appendStringInfo(es->str, " inserted=%.0f", insert_path);
- if (update_path > 0)
- appendStringInfo(es->str, " updated=%.0f", update_path);
- if (delete_path > 0)
- appendStringInfo(es->str, " deleted=%.0f", delete_path);
- if (skipped_path > 0)
- appendStringInfo(es->str, " skipped=%.0f", skipped_path);
- appendStringInfoChar(es->str, '\n');
+ if (total > 0)
+ {
+ ExplainIndentText(es);
+ appendStringInfoString(es->str, "Tuples:");
+ if (insert_path > 0)
+ appendStringInfo(es->str, " inserted=%.0f", insert_path);
+ if (update_path > 0)
+ appendStringInfo(es->str, " updated=%.0f", update_path);
+ if (delete_path > 0)
+ appendStringInfo(es->str, " deleted=%.0f", delete_path);
+ if (skipped_path > 0)
+ appendStringInfo(es->str, " skipped=%.0f", skipped_path);
+ appendStringInfoChar(es->str, '\n');
+ }
}
else
{