Re: [HACKERS] auto_explain produces invalid JSON

2012-02-13 Thread Andrew Dunstan
On 02/13/2012 01:33 PM, Andrew Dunstan wrote: On 02/13/2012 12:48 PM, Tom Lane wrote: Andrew Dunstan writes: On 02/13/2012 11:15 AM, Tom Lane wrote: After looking a bit more at the existing explain code, it seems like the critical issue is that explain.c has ExplainOpenGroup/ExplainClose

Re: [HACKERS] auto_explain produces invalid JSON

2012-02-13 Thread Andrew Dunstan
On 02/13/2012 12:48 PM, Tom Lane wrote: Andrew Dunstan writes: On 02/13/2012 11:15 AM, Tom Lane wrote: After looking a bit more at the existing explain code, it seems like the critical issue is that explain.c has ExplainOpenGroup/ExplainCloseGroup calls around the ExplainPrintPlan call (see

Re: [HACKERS] auto_explain produces invalid JSON

2012-02-13 Thread Tom Lane
Andrew Dunstan writes: > On 02/13/2012 11:15 AM, Tom Lane wrote: >> After looking a bit more at the existing explain code, it seems like the >> critical issue is that explain.c has ExplainOpenGroup/ExplainCloseGroup >> calls around the ExplainPrintPlan call (see ExplainOnePlan), while >> auto_expl

Re: [HACKERS] auto_explain produces invalid JSON

2012-02-13 Thread Andrew Dunstan
On 02/13/2012 11:15 AM, Tom Lane wrote: [ sorry for ignoring this over the weekend --- I wasn't feeling very well ] Andrew Dunstan writes: On 02/11/2012 03:22 PM, Tom Lane wrote: I'm inclined to think that this is auto_explain's error, not that of the core code, ie we should be changing the

Re: [HACKERS] auto_explain produces invalid JSON

2012-02-13 Thread Tom Lane
[ sorry for ignoring this over the weekend --- I wasn't feeling very well ] Andrew Dunstan writes: > On 02/11/2012 03:22 PM, Tom Lane wrote: >> 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 t

Re: [HACKERS] auto_explain produces invalid JSON

2012-02-11 Thread Andrew Dunstan
On 02/11/2012 03:22 PM, Tom Lane wrote: Andrew Dunstan 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 on

Re: [HACKERS] auto_explain produces invalid JSON

2012-02-11 Thread Andrew Dunstan
On 02/11/2012 03:22 PM, Tom Lane wrote: Andrew Dunstan 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 on

Re: [HACKERS] auto_explain produces invalid JSON

2012-02-11 Thread Tom Lane
Andrew Dunstan 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 q

Re: [HACKERS] auto_explain produces invalid JSON

2012-02-11 Thread Andrew Dunstan
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);

Re: [HACKERS] auto_explain produces invalid JSON

2012-02-11 Thread Andrew Dunstan
On 02/10/2012 01:14 PM, Peter Eisentraut wrote: The auto_explain module appears to create invalid JSON (in all versions since 9.0). For example, with the settings auto_explain.log_format = 'json' auto_explain.log_min_duration = 0 the query select * from pg_type; produces this in the log:

[HACKERS] auto_explain produces invalid JSON

2012-02-10 Thread Peter Eisentraut
The auto_explain module appears to create invalid JSON (in all versions since 9.0). For example, with the settings auto_explain.log_format = 'json' auto_explain.log_min_duration = 0 the query select * from pg_type; produces this in the log: LOG: duration: 529.808 ms plan: [