summaryrefslogtreecommitdiff
path: root/src/include/commands
diff options
context:
space:
mode:
authorMichael Paquier2024-03-10 23:40:40 +0000
committerMichael Paquier2024-03-10 23:40:40 +0000
commita04ddd077e61096da660e1c2f205e0c8277f2dcd (patch)
treebfe3bdf4f135343cd1c3cd074737b972038942d1 /src/include/commands
parentc399248b3b44bd6cece1ada47eee346b67a88a0a (diff)
Improve support for ExplainOneQuery() hook
There is a hook called ExplainOneQuery_hook that gives modules the possibility to plug into this code path, but, like utility.c for utility statement execution, there is no corresponding "standard" routine in the case of EXPLAIN executed for one Query. This commit adds a new standard_ExplainOneQuery() in explain.c, which is able to run explain on a non-utility Query without calling its hook. Per the feedback received from a couple of hackers, this change gives the possibility to cut a few hundred lines of code in some of the popular out-of-core modules as these maintained a copy of ExplainOneQuery(), adding custom extra information at the beginning or the end of the EXPLAIN output. Author: Mats Kindahl Reviewed-by: Aleksander Alekseev, Jelte Fennema-Nio, Andrei Lepikhov Discussion: https://postgr.es/m/CA+14427V_B4EAoC_o-iYYucRdMSOTfpuH9k-QbexffY1HYJBiA@mail.gmail.com
Diffstat (limited to 'src/include/commands')
-rw-r--r--src/include/commands/explain.h4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/include/commands/explain.h b/src/include/commands/explain.h
index 7c0f0b56365..cf195f13597 100644
--- a/src/include/commands/explain.h
+++ b/src/include/commands/explain.h
@@ -80,6 +80,10 @@ extern PGDLLIMPORT explain_get_index_name_hook_type explain_get_index_name_hook;
extern void ExplainQuery(ParseState *pstate, ExplainStmt *stmt,
ParamListInfo params, DestReceiver *dest);
+extern void standard_ExplainOneQuery(Query *query, int cursorOptions,
+ IntoClause *into, ExplainState *es,
+ const char *queryString, ParamListInfo params,
+ QueryEnvironment *queryEnv);
extern ExplainState *NewExplainState(void);