From 02490d4692c46bee3e9279e79c5d07c576d2a32c Mon Sep 17 00:00:00 2001 From: Robert Haas Date: Sat, 12 Dec 2009 00:35:34 +0000 Subject: 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. --- contrib/auto_explain/auto_explain.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'contrib/auto_explain/auto_explain.c') 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') -- cgit v1.2.3