Hi,
I found a variable (queryEnv) which should be added in
ExplainOneQuery_hook because if it is missing, hook function
can't call ExplainOnePlan.
Sorry if this wasn't correct.
Please find attached a patch.
Tatsuro Yamada
NTT Open Source Software Center
diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c
index 79e6985..41cd47e 100644
--- a/src/backend/commands/explain.c
+++ b/src/backend/commands/explain.c
@@ -351,7 +351,7 @@ ExplainOneQuery(Query *query, int cursorOptions,
/* if an advisor plugin is present, let it manage things */
if (ExplainOneQuery_hook)
(*ExplainOneQuery_hook) (query, cursorOptions, into, es,
- queryString, params);
+ queryString, params, queryEnv);
else
{
PlannedStmt *plan;
diff --git a/src/include/commands/explain.h b/src/include/commands/explain.h
index dd8abae..0c3986a 100644
--- a/src/include/commands/explain.h
+++ b/src/include/commands/explain.h
@@ -53,7 +53,8 @@ typedef void (*ExplainOneQuery_hook_type) (Query *query,
IntoClause *into,
ExplainState *es,
const char *queryString,
- ParamListInfo params);
+ ParamListInfo params,
+ QueryEnvironment *queryEnv);
extern PGDLLIMPORT ExplainOneQuery_hook_type ExplainOneQuery_hook;
/* Hook for plugins to get control in explain_get_index_name() */