Re: auto_explain produces invalid JSON

From: Andrew Dunstan <andrew(at)dunslane(dot)net>
To: Tom Lane <tgl(at)sss(dot)pgh(dot)pa(dot)us>
Cc: Peter Eisentraut <peter_e(at)gmx(dot)net>, pgsql-hackers <pgsql-hackers(at)postgresql(dot)org>
Subject: Re: auto_explain produces invalid JSON
Date: 2012-02-11 21:56:15
Message-ID: 4F36E3FF.90901@dunslane.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-hackers

On 02/11/2012 03:22 PM, Tom Lane wrote:
> Andrew Dunstan<andrew(at)dunslane(dot)net> writes:
>> 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.
> What about queries that expand to multiple plans because of rules?

... and the answer is it logs them in separate pieces of JSON.

>
>> 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?)
> I'm inclined to think that this is auto_explain's error, not that of
> the core code, ie we should be changing the output.
>
>

Well, maybe this is more to your taste, although it strikes me as more
than something of a kludge. At least it's short :-)

cheers

andrew

Attachment Content-Type Size
explain2.patch text/x-patch 611 bytes

In response to

Responses

Browse pgsql-hackers by date

  From Date Subject
Next Message Tom Lane 2012-02-11 23:48:23 Re: pl/python long-lived allocations in datum->dict transformation
Previous Message Andrew Dunstan 2012-02-11 21:26:55 Re: auto_explain produces invalid JSON