Skip to content
Snippets Groups Projects
Commit 21320763 authored by Andrew Dunstan's avatar Andrew Dunstan
Browse files

Fix auto-explain JSON output to be valid JSON.

Problem reported by Peter Eisentraut.

Backpatched to release 9.0.
parent 21b16342
No related branches found
No related tags found
No related merge requests found
...@@ -299,6 +299,13 @@ explain_ExecutorEnd(QueryDesc *queryDesc) ...@@ -299,6 +299,13 @@ explain_ExecutorEnd(QueryDesc *queryDesc)
if (es.str->len > 0 && es.str->data[es.str->len - 1] == '\n') if (es.str->len > 0 && es.str->data[es.str->len - 1] == '\n')
es.str->data[--es.str->len] = '\0'; es.str->data[--es.str->len] = '\0';
/* Fix JSON to output an object */
if (auto_explain_log_format == EXPLAIN_FORMAT_JSON)
{
es.str->data[0] = '{';
es.str->data[es.str->len - 1] = '}';
}
/* /*
* Note: we rely on the existing logging of context or * Note: we rely on the existing logging of context or
* debug_query_string to identify just which statement is being * debug_query_string to identify just which statement is being
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment