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-qbexffy1hyj...@mail.gmail.com

Branch
------
master

Details
-------
https://git.postgresql.org/pg/commitdiff/a04ddd077e61096da660e1c2f205e0c8277f2dcd

Modified Files
--------------
src/backend/commands/explain.c | 106 +++++++++++++++++++++++------------------
src/include/commands/explain.h |   4 ++
2 files changed, 63 insertions(+), 47 deletions(-)

Reply via email to