Remove unnecessary VerifyMultiPlanValidity and use RaiseDeferredError directly

pull/1288/head
Metin Doslu 2017-03-10 12:09:10 +02:00
parent 9fcf42d5cd
commit 243ff736c4
3 changed files with 6 additions and 33 deletions

View File

@ -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;
}

View File

@ -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.

View File

@ -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);