From 243ff736c40cfd8b7e94fe3624ce34886360ee4d Mon Sep 17 00:00:00 2001 From: Metin Doslu Date: Fri, 10 Mar 2017 12:09:10 +0200 Subject: [PATCH] Remove unnecessary VerifyMultiPlanValidity and use RaiseDeferredError directly --- .../distributed/executor/multi_executor.c | 18 ++++++----------- .../distributed/planner/multi_planner.c | 20 ------------------- src/include/distributed/multi_planner.h | 1 - 3 files changed, 6 insertions(+), 33 deletions(-) diff --git a/src/backend/distributed/executor/multi_executor.c b/src/backend/distributed/executor/multi_executor.c index b5a94efa7..3c23dff56 100644 --- a/src/backend/distributed/executor/multi_executor.c +++ b/src/backend/distributed/executor/multi_executor.c @@ -173,24 +173,18 @@ RouterCreateScan(CustomScan *scan) * CreateDistributedPlan() couldn't find a plan due to unresolved prepared * statement parameters, but didn't error out, because we expect custom plans * to come to our rescue. But sql (not plpgsql) functions unfortunately don't - * go through a codepath supporting custom plans. We call VerifyMultiPlanValidity() - * to do this check and provide a meaningfull error message. + * go through a codepath supporting custom plans. Here, we error out with this + * delayed error message. */ Node * DelayedErrorCreateScan(CustomScan *scan) { - CitusScanState *scanState = palloc0(sizeof(CitusScanState)); + MultiPlan *multiPlan = GetMultiPlan(scan); - scanState->executorType = MULTI_EXECUTOR_INVALID_FIRST; - scanState->customScanState.ss.ps.type = T_CustomScanState; - scanState->multiPlan = GetMultiPlan(scan); + /* raise the deferred error */ + RaiseDeferredError(multiPlan->planningError, ERROR); - Assert(IsA(scanState, CustomScanState)); - - /* ensure plan is executable */ - VerifyMultiPlanValidity(scanState->multiPlan); - - return (Node *) scanState; + return NULL; } diff --git a/src/backend/distributed/planner/multi_planner.c b/src/backend/distributed/planner/multi_planner.c index 172978b40..02e595bcc 100644 --- a/src/backend/distributed/planner/multi_planner.c +++ b/src/backend/distributed/planner/multi_planner.c @@ -180,26 +180,6 @@ IsModifyMultiPlan(MultiPlan *multiPlan) } -/* - * VerifyMultiPlanValidity verifies that multiPlan is ready for execution, or - * errors out if not. - * - * A plan may e.g. not be ready for execution because CreateDistributedPlan() - * couldn't find a plan due to unresolved prepared statement parameters, but - * didn't error out, because we expect custom plans to come to our rescue. - * But sql (not plpgsql) functions unfortunately don't go through a codepath - * supporting custom plans. - */ -void -VerifyMultiPlanValidity(MultiPlan *multiPlan) -{ - if (multiPlan->planningError) - { - RaiseDeferredError(multiPlan->planningError, ERROR); - } -} - - /* * CreateDistributedPlan encapsulates the logic needed to transform a particular * query into a distributed plan. diff --git a/src/include/distributed/multi_planner.h b/src/include/distributed/multi_planner.h index ed9dae4ea..8a24b2efa 100644 --- a/src/include/distributed/multi_planner.h +++ b/src/include/distributed/multi_planner.h @@ -57,7 +57,6 @@ extern void multi_relation_restriction_hook(PlannerInfo *root, RelOptInfo *relOp Index index, RangeTblEntry *rte); extern bool IsModifyCommand(Query *query); extern bool IsModifyMultiPlan(struct MultiPlan *multiPlan); -extern void VerifyMultiPlanValidity(struct MultiPlan *multiPlan); extern RangeTblEntry * RemoteScanRangeTableEntry(List *columnNameList);