From 688ab16bbaf4c7dd88ddda92f29ff01a934785e8 Mon Sep 17 00:00:00 2001 From: Sait Talha Nisanci Date: Wed, 20 May 2020 11:48:09 +0300 Subject: [PATCH] Introduce ExplainOnePlanCompat Since ExplainOnePlan expects BufferUsage as well with PG >= 13, ExplainOnePlanCompat is added. Commit on Postgres side: ed7a5095716ee498ecc406e1b8d5ab92c7662d10 --- src/backend/distributed/planner/multi_explain.c | 6 +++--- src/include/distributed/version_compat.h | 2 ++ 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/backend/distributed/planner/multi_explain.c b/src/backend/distributed/planner/multi_explain.c index 9b0cc1e2f..b134078b5 100644 --- a/src/backend/distributed/planner/multi_explain.c +++ b/src/backend/distributed/planner/multi_explain.c @@ -313,7 +313,7 @@ ExplainSubPlans(DistributedPlan *distributedPlan, ExplainState *es) INSTR_TIME_SET_ZERO(planduration); - ExplainOnePlan(plan, into, es, queryString, params, NULL, &planduration); + ExplainOnePlanCompat(plan, into, es, queryString, params, NULL, &planduration, NULL); if (es->format == EXPLAIN_FORMAT_TEXT) { @@ -1463,8 +1463,8 @@ ExplainOneQuery(Query *query, int cursorOptions, INSTR_TIME_SUBTRACT(planduration, planstart); /* run it (if needed) and produce output */ - ExplainOnePlan(plan, into, es, queryString, params, queryEnv, - &planduration); + ExplainOnePlanCompat(plan, into, es, queryString, params, queryEnv, + &planduration, NULL); } } diff --git a/src/include/distributed/version_compat.h b/src/include/distributed/version_compat.h index be38c468c..cc5357ad0 100644 --- a/src/include/distributed/version_compat.h +++ b/src/include/distributed/version_compat.h @@ -36,6 +36,7 @@ #define standard_planner_compat(a,b,c,d) standard_planner(a,b,c,d) #define PortalDefineQuerySelectCompat(a,b,c,e,f) PortalDefineQuery(a,b,c,CMDTAG_SELECT,e,f) #define getOwnedSequencesCompat(a,b) getOwnedSequences(a) +#define ExplainOnePlanCompat(a,b,c,d,e,f,g,h) ExplainOnePlan(a,b,c,d,e,f,g,h) #else /* pre PG13 */ #define lnext_compat(l, r) lnext(r) #define list_delete_cell_compat(l,c,p) list_delete_cell(l,c,p) @@ -44,6 +45,7 @@ #define standard_planner_compat(a,b,c,d) standard_planner(a,c,d) #define PortalDefineQuerySelectCompat(a,b,c,e,f) PortalDefineQuery(a,b,c,"SELECT",e,f) #define getOwnedSequencesCompat(a,b) getOwnedSequences(a,b) +#define ExplainOnePlanCompat(a,b,c,d,e,f,g,h) ExplainOnePlan(a,b,c,d,e,f,g) #endif #if PG_VERSION_NUM >= PG_VERSION_12