aboutsummaryrefslogtreecommitdiff
path: root/contrib/auto_explain/auto_explain.c
diff options
context:
space:
mode:
authorRobert Haas <rhaas@postgresql.org>2009-12-12 00:35:34 +0000
committerRobert Haas <rhaas@postgresql.org>2009-12-12 00:35:34 +0000
commit02490d4692c46bee3e9279e79c5d07c576d2a32c (patch)
tree110854a6ec9e7e61d4c0e846650f0a78694f34a9 /contrib/auto_explain/auto_explain.c
parent6b45e3b7aaa0a66082f61921e01f6df6e9f9253f (diff)
downloadpostgresql-02490d4692c46bee3e9279e79c5d07c576d2a32c.tar.gz
postgresql-02490d4692c46bee3e9279e79c5d07c576d2a32c.zip
Export ExplainBeginOutput() and ExplainEndOutput() for auto_explain.
Without these functions, anyone outside of explain.c can't actually use ExplainPrintPlan, because the ExplainState won't be initialized properly. The user-visible result of this was a crash when using auto_explain with the JSON output format. Report by Euler Taveira de Oliveira. Analysis by Tom Lane. Patch by me.
Diffstat (limited to 'contrib/auto_explain/auto_explain.c')
-rw-r--r--contrib/auto_explain/auto_explain.c4
1 files changed, 3 insertions, 1 deletions
diff --git a/contrib/auto_explain/auto_explain.c b/contrib/auto_explain/auto_explain.c
index 531f0765254..88d40c71887 100644
--- a/contrib/auto_explain/auto_explain.c
+++ b/contrib/auto_explain/auto_explain.c
@@ -6,7 +6,7 @@
* Copyright (c) 2008-2009, PostgreSQL Global Development Group
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/contrib/auto_explain/auto_explain.c,v 1.8 2009/12/11 01:33:35 adunstan Exp $
+ * $PostgreSQL: pgsql/contrib/auto_explain/auto_explain.c,v 1.9 2009/12/12 00:35:33 rhaas Exp $
*
*-------------------------------------------------------------------------
*/
@@ -223,7 +223,9 @@ explain_ExecutorEnd(QueryDesc *queryDesc)
es.verbose = auto_explain_log_verbose;
es.format = auto_explain_log_format;
+ ExplainBeginOutput(&es);
ExplainPrintPlan(&es, queryDesc);
+ ExplainEndOutput(&es);
/* Remove last line break */
if (es.str->len > 0 && es.str->data[es.str->len - 1] == '\n')