On Mon, Dec 14, 2009 at 12:59 PM, Robert Haas <robertmhaas@gmail.com> wrote:
>> The new explain formats break if you have a multi-query statement.
> I will fix this, unless someone else beats me to it.
Proposed patch attached. The problem with JSON output is pretty
simple - ExplainSeparatePlans() still thinks it's responsible for
comma-separating JSON plans, but in fact the new grouping_stack
machinery is smart enough to handle that on its own, so they each add
a comma. The YAML format also inserts a needless separator, but the
real problem is that ExplainBeginGroup() and ExplainYAMLLineStarting()
have an odd division of labor for marking each list element with "- ",
with each providing one character. That fails to work as expected.
I also noticed that ExplainDummyGroup() is hosed for the YAML format,
so I fixed that as well.
Along the way, I also made the YAML format use escape_yaml() in
situations where the JSON format uses escape_json(). Right now it
doesn't matter because all the values are known to not need escaping,
but it seems safer this way. And, it took me a bit of time to
understand the YAML format as it was not really commented, so I added
some comments here as well.
...Robert