|
1 | | -diff --git a/src/backend/commands/explain.c b/src/backend/commands/explain.c |
2 | | -index 22616cf7add..8a28b783f72 100644 |
3 | | ---- a/src/backend/commands/explain.c |
4 | | -+++ b/src/backend/commands/explain.c |
5 | | -@@ -29,6 +29,7 @@ |
6 | | - #include "nodes/extensible.h" |
7 | | - #include "nodes/makefuncs.h" |
8 | | - #include "nodes/nodeFuncs.h" |
9 | | -+#include "optimizer/cost.h" |
10 | | - #include "parser/analyze.h" |
11 | | - #include "parser/parsetree.h" |
12 | | - #include "rewrite/rewriteHandler.h" |
13 | | -@@ -45,6 +46,12 @@ |
14 | | - #include "utils/typcache.h" |
15 | | - #include "utils/xml.h" |
16 | | - |
17 | | -+/* Hook for plugins to get control in ExplainOnePlan() */ |
18 | | -+ExplainOnePlan_hook_type ExplainOnePlan_hook = NULL; |
19 | | -+ |
20 | | -+/* Hook for plugins to get control in ExplainOnePlan() */ |
21 | | -+ExplainOneNode_hook_type ExplainOneNode_hook = NULL; |
22 | | -+ |
23 | | - |
24 | | - /* Hook for plugins to get control in ExplainOneQuery() */ |
25 | | - ExplainOneQuery_hook_type ExplainOneQuery_hook = NULL; |
26 | | -@@ -690,6 +697,10 @@ ExplainOnePlan(PlannedStmt *plannedstmt, CachedPlan *cplan, |
27 | | - ExplainPropertyFloat("Execution Time", "ms", 1000.0 * totaltime, 3, |
28 | | - es); |
29 | | - |
30 | | -+ if (ExplainOnePlan_hook) |
31 | | -+ ExplainOnePlan_hook(plannedstmt, into, es, |
32 | | -+ queryString, params, planduration, queryEnv); |
33 | | -+ |
34 | | - ExplainCloseGroup("Query", NULL, true, es); |
35 | | - } |
36 | | - |
37 | | -@@ -1884,6 +1895,9 @@ ExplainNode(PlanState *planstate, List *ancestors, |
38 | | - } |
39 | | - } |
40 | | - |
41 | | -+ if (ExplainOneNode_hook) |
42 | | -+ ExplainOneNode_hook(es, planstate, plan); |
43 | | -+ |
44 | | - /* in text format, first line ends here */ |
45 | | - if (es->format == EXPLAIN_FORMAT_TEXT) |
46 | | - appendStringInfoChar(es->str, '\n'); |
47 | 1 | diff --git a/src/backend/optimizer/path/costsize.c b/src/backend/optimizer/path/costsize.c |
48 | 2 | index 256568d05a2..914f6124e67 100644 |
49 | 3 | --- a/src/backend/optimizer/path/costsize.c |
@@ -520,29 +474,6 @@ index 5b35debc8ff..06a7bebe4f8 100644 |
520 | 474 | /* |
521 | 475 | * estimate_num_groups - Estimate number of groups in a grouped query |
522 | 476 | * |
523 | | -diff --git a/src/include/commands/explain.h b/src/include/commands/explain.h |
524 | | -index e8e92f966a1..323b3391b35 100644 |
525 | | ---- a/src/include/commands/explain.h |
526 | | -+++ b/src/include/commands/explain.h |
527 | | -@@ -49,6 +49,18 @@ extern PGDLLIMPORT explain_per_node_hook_type explain_per_node_hook; |
528 | | - typedef const char *(*explain_get_index_name_hook_type) (Oid indexId); |
529 | | - extern PGDLLIMPORT explain_get_index_name_hook_type explain_get_index_name_hook; |
530 | | - |
531 | | -+/* Hook for plugins to get control in ExplainOnePlan() */ |
532 | | -+typedef void (*ExplainOnePlan_hook_type) (PlannedStmt *plannedstmt, IntoClause *into, |
533 | | -+ struct ExplainState *es, const char *queryString, |
534 | | -+ ParamListInfo params, const instr_time *planduration, |
535 | | -+ QueryEnvironment *queryEnv); |
536 | | -+extern PGDLLIMPORT ExplainOnePlan_hook_type ExplainOnePlan_hook; |
537 | | -+ |
538 | | -+/* Explain a node info */ |
539 | | -+typedef void (*ExplainOneNode_hook_type) (struct ExplainState *es, |
540 | | -+ PlanState *ps, |
541 | | -+ Plan *plan); |
542 | | -+extern PGDLLIMPORT ExplainOneNode_hook_type ExplainOneNode_hook; |
543 | | - |
544 | | - extern void ExplainQuery(ParseState *pstate, ExplainStmt *stmt, |
545 | | - ParamListInfo params, DestReceiver *dest); |
546 | 477 | diff --git a/src/include/nodes/pathnodes.h b/src/include/nodes/pathnodes.h |
547 | 478 | index fbf05322c75..8fcb1fadda6 100644 |
548 | 479 | --- a/src/include/nodes/pathnodes.h |
|
0 commit comments