Re: auto_explain produces invalid JSON

Поиск
Список
Период
Сортировка
От Andrew Dunstan
Тема Re: auto_explain produces invalid JSON
Дата
Msg-id 4F36CB91.3030304@dunslane.net
обсуждение исходный текст
Ответ на Re: auto_explain produces invalid JSON  (Andrew Dunstan <andrew@dunslane.net>)
Список 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



Вложения

В списке pgsql-hackers по дате отправления:

Предыдущее
От: Tom Lane
Дата:
Сообщение: Re: plpgsql leaking memory when stringifying datums
Следующее
От: Tom Lane
Дата:
Сообщение: Re: auto_explain produces invalid JSON