Skip to content

Commit 2132076

Browse files
committed
Fix auto-explain JSON output to be valid JSON.
Problem reported by Peter Eisentraut. Backpatched to release 9.0.
1 parent 21b1634 commit 2132076

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

contrib/auto_explain/auto_explain.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,13 @@ explain_ExecutorEnd(QueryDesc *queryDesc)
299299
if (es.str->len > 0 && es.str->data[es.str->len - 1] == '\n')
300300
es.str->data[--es.str->len] = '\0';
301301

302+
/* Fix JSON to output an object */
303+
if (auto_explain_log_format == EXPLAIN_FORMAT_JSON)
304+
{
305+
es.str->data[0] = '{';
306+
es.str->data[es.str->len - 1] = '}';
307+
}
308+
302309
/*
303310
* Note: we rely on the existing logging of context or
304311
* debug_query_string to identify just which statement is being

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy