mirror of https://github.com/citusdata/citus.git
Reset planner restriction context instead of popping with recursive planning
parent
339e6e661e
commit
1bb0ec316a
|
@ -84,6 +84,8 @@ static List * CopyPlanParamList(List *originalPlanParamList);
|
|||
static PlannerRestrictionContext * CreateAndPushPlannerRestrictionContext(void);
|
||||
static PlannerRestrictionContext * CurrentPlannerRestrictionContext(void);
|
||||
static void PopPlannerRestrictionContext(void);
|
||||
static void ResetPlannerRestrictionContext(
|
||||
PlannerRestrictionContext *plannerRestrictionContext);
|
||||
static bool HasUnresolvedExternParamsWalker(Node *expression, ParamListInfo boundParams);
|
||||
|
||||
|
||||
|
@ -700,12 +702,11 @@ CreateDistributedPlan(uint64 planId, Query *originalQuery, Query *query, ParamLi
|
|||
{
|
||||
Query *newQuery = copyObject(originalQuery);
|
||||
bool setPartitionedTablesInherited = false;
|
||||
PlannerRestrictionContext *currentPlannerRestrictionContext =
|
||||
CurrentPlannerRestrictionContext();
|
||||
|
||||
/* remove the pre-transformation planner restrictions context */
|
||||
PopPlannerRestrictionContext();
|
||||
|
||||
/* create a fresh new planner context */
|
||||
plannerRestrictionContext = CreateAndPushPlannerRestrictionContext();
|
||||
/* reset the current planner restrictions context */
|
||||
ResetPlannerRestrictionContext(currentPlannerRestrictionContext);
|
||||
|
||||
/*
|
||||
* We force standard_planner to treat partitioned tables as regular tables
|
||||
|
@ -1534,6 +1535,24 @@ PopPlannerRestrictionContext(void)
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
* ResetPlannerRestrictionContext resets the element of the given planner
|
||||
* restriction context.
|
||||
*/
|
||||
static void
|
||||
ResetPlannerRestrictionContext(PlannerRestrictionContext *plannerRestrictionContext)
|
||||
{
|
||||
plannerRestrictionContext->relationRestrictionContext =
|
||||
palloc0(sizeof(RelationRestrictionContext));
|
||||
|
||||
plannerRestrictionContext->joinRestrictionContext =
|
||||
palloc0(sizeof(JoinRestrictionContext));
|
||||
|
||||
/* we'll apply logical AND as we add tables */
|
||||
plannerRestrictionContext->relationRestrictionContext->allReferenceTables = true;
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
* HasUnresolvedExternParamsWalker returns true if the passed in expression
|
||||
* has external parameters that are not contained in boundParams, false
|
||||
|
|
Loading…
Reference in New Issue