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 and...@dunslane.net 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

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 Dunstanand...@dunslane.net 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

Re: [HACKERS] auto_explain produces invalid JSON

2012-02-13 Thread Tom Lane
Andrew Dunstan and...@dunslane.net 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

Re: [HACKERS] auto_explain produces invalid JSON

2012-02-13 Thread Andrew Dunstan
On 02/13/2012 12:48 PM, Tom Lane wrote: Andrew Dunstanand...@dunslane.net 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

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 Dunstanand...@dunslane.net 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

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:

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 Tom Lane
Andrew Dunstan and...@dunslane.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.

Re: [HACKERS] auto_explain produces invalid JSON

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

Re: [HACKERS] auto_explain produces invalid JSON

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

[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: [