]> granicus.if.org Git - postgresql/commitdiff
Add QueryEnvironment to ExplainOneQuery_hook's parameter list.
authorTom Lane <tgl@sss.pgh.pa.us>
Thu, 11 Jan 2018 17:16:18 +0000 (12:16 -0500)
committerTom Lane <tgl@sss.pgh.pa.us>
Thu, 11 Jan 2018 17:16:18 +0000 (12:16 -0500)
This should have been done in commit 18ce3a4ab, which added that parameter
to ExplainOneQuery, but it was overlooked.  This makes it impossible for
a user of the hook to pass the queryEnv down to ExplainOnePlan.

It's too late to change this API in v10, I suppose, but fortunately
passing NULL to ExplainOnePlan will work in nearly all interesting
cases in v10.  That might not be true forever, so we'd better fix it.

Tatsuro Yamada, reviewed by Thomas Munro

Discussion: https://postgr.es/m/890e8dd9-c1c7-a422-6892-874f5eaee048@lab.ntt.co.jp

src/backend/commands/explain.c
src/include/commands/explain.h

index 79e6985d0dda3e71e8434e303d6a49d9deb305e0..41cd47e8bcddd44ade423df0cb6cf16a6a55e0d0 100644 (file)
@@ -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;
index dd8abae98a23606bccd61386b58c44a9f4ff085b..0c3986ae17bc78cfd123c9a60a2177f37a566afd 100644 (file)
@@ -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() */