projects
/
postgresql
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
03c66ca
)
Fix auto-explain JSON output to be valid JSON.
author
Andrew Dunstan
<andrew@dunslane.net>
Mon, 13 Feb 2012 13:23:13 +0000
(08:23 -0500)
committer
Andrew Dunstan
<andrew@dunslane.net>
Mon, 13 Feb 2012 13:23:13 +0000
(08:23 -0500)
Problem reported by Peter Eisentraut.
Backpatched to release 9.0.
contrib/auto_explain/auto_explain.c
patch
|
blob
|
history
diff --git
a/contrib/auto_explain/auto_explain.c
b/contrib/auto_explain/auto_explain.c
index ffc1a4a10633a6b41903abe849963b4931eb78bf..0bd23478b1289db595c4b3b0b565695a29807640 100644
(file)
--- a/
contrib/auto_explain/auto_explain.c
+++ b/
contrib/auto_explain/auto_explain.c
@@
-248,6
+248,13
@@
explain_ExecutorEnd(QueryDesc *queryDesc)
if (es.str->len > 0 && es.str->data[es.str->len - 1] == '\n')
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
* debug_query_string to identify just which statement is being