From: | Andrew Dunstan <andrew(at)dunslane(dot)net> |
---|---|
To: | Peter Eisentraut <peter_e(at)gmx(dot)net> |
Cc: | pgsql-hackers <pgsql-hackers(at)postgresql(dot)org> |
Subject: | Re: auto_explain produces invalid JSON |
Date: | 2012-02-11 20:12:01 |
Message-ID: | 4F36CB91.3030304@dunslane.net |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-hackers |
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
Attachment | Content-Type | Size |
---|---|---|
explain.patch | text/x-patch | 2.5 KB |
From | Date | Subject | |
---|---|---|---|
Next Message | Tom Lane | 2012-02-11 20:22:11 | Re: auto_explain produces invalid JSON |
Previous Message | Tom Lane | 2012-02-11 20:10:01 | Re: plpgsql leaking memory when stringifying datums |