On 02/11/2012 01:18 PM, Andrew Dunstan wrote:
>
>
> On 02/10/2012 01:14 PM, Peter Eisentraut wrote:
>> [ auto-explain JSON output should be an object instead of an array ]
>
>
>
> Yeah, looks like this dates back to when we first got JSON output.
>
> Auto-explain does this:
>
> ExplainBeginOutput(&es);
> ExplainQueryText(&es, queryDesc);
> ExplainPrintPlan(&es, queryDesc);
> ExplainEndOutput(&es);
>
>
> But ExplainBeginOutput says:
>
> case EXPLAIN_FORMAT_JSON:
> /* top-level structure is an array of plans */
> appendStringInfoChar(es->str, '[');
>
>
> Now that's not true in the auto-explain case, which prints one query +
> one plan.
>
> Since this is an exposed API, I don't think we can just change it. We
> probably need a new API that does the right thing for beginning and
> ending auto_explain output. (ExplainBeginLabeledOutput?)
>
>
PFA a patch along these lines, which seems to do the Right Thing (tm)
cheers
andrew