From b9680099be491baf87c1baac80fe1bf27514bf89 Mon Sep 17 00:00:00 2001 From: Markus Winand Date: Thu, 20 Oct 2016 13:15:23 +0200 Subject: [PATCH] Fix invalid XML explain plans for track_io_timing Treat '/' in XML tag names (e.g., "I/O Read Time") like space and translate it to '-' when formatting an explain plan as XML. --- src/backend/commands/explain.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c index 1247433..91b9158 100644 --- a/src/backend/commands/explain.c +++ b/src/backend/commands/explain.c @@ -3312,7 +3312,7 @@ ExplainSeparatePlans(ExplainState *es) * Optionally, OR in X_NOWHITESPACE to suppress the whitespace we'd normally * add. * - * XML tag names can't contain white space, so we replace any spaces in + * XML tag names can't contain white space or slashes, so we replace them in * "tagname" with dashes. */ static void @@ -3326,7 +3326,7 @@ ExplainXMLTag(const char *tagname, int flags, ExplainState *es) if ((flags & X_CLOSING) != 0) appendStringInfoCharMacro(es->str, '/'); for (s = tagname; *s; s++) - appendStringInfoCharMacro(es->str, (*s == ' ') ? '-' : *s); + appendStringInfoCharMacro(es->str, (*s == ' ' || *s == '/') ? '-' : *s); if ((flags & X_CLOSE_IMMEDIATE) != 0) appendStringInfoString(es->str, " /"); appendStringInfoCharMacro(es->str, '>'); -- 2.8.4 (Apple Git-73)