mirror of
https://github.com/postgres/postgres.git
synced 2025-07-08 11:42:09 +03:00
Relocate partition pruning structs to a saner place.
These struct definitions were originally dropped into primnodes.h, which is a poor choice since that's mainly intended for primitive expression node types; these are not in that category. What they are is auxiliary info in Plan trees, so move them to plannodes.h. For consistency, also relocate some related code that was apparently placed with the aid of a dartboard. There's no interesting code changes in this commit, just reshuffling. David Rowley and Tom Lane Discussion: https://postgr.es/m/CAFj8pRBjrufA3ocDm8o4LPGNye9Y+pm1b9kCwode4X04CULG3g@mail.gmail.com
This commit is contained in:
@ -242,9 +242,9 @@ _copyAppend(const Append *from)
|
||||
/*
|
||||
* copy remainder of node
|
||||
*/
|
||||
COPY_NODE_FIELD(partitioned_rels);
|
||||
COPY_NODE_FIELD(appendplans);
|
||||
COPY_SCALAR_FIELD(first_partial_plan);
|
||||
COPY_NODE_FIELD(partitioned_rels);
|
||||
COPY_NODE_FIELD(part_prune_infos);
|
||||
|
||||
return newnode;
|
||||
@ -1176,6 +1176,58 @@ _copyPlanRowMark(const PlanRowMark *from)
|
||||
return newnode;
|
||||
}
|
||||
|
||||
static PartitionPruneInfo *
|
||||
_copyPartitionPruneInfo(const PartitionPruneInfo *from)
|
||||
{
|
||||
PartitionPruneInfo *newnode = makeNode(PartitionPruneInfo);
|
||||
|
||||
COPY_SCALAR_FIELD(reloid);
|
||||
COPY_NODE_FIELD(pruning_steps);
|
||||
COPY_BITMAPSET_FIELD(present_parts);
|
||||
COPY_SCALAR_FIELD(nparts);
|
||||
COPY_SCALAR_FIELD(nexprs);
|
||||
COPY_POINTER_FIELD(subnode_map, from->nparts * sizeof(int));
|
||||
COPY_POINTER_FIELD(subpart_map, from->nparts * sizeof(int));
|
||||
COPY_POINTER_FIELD(hasexecparam, from->nexprs * sizeof(bool));
|
||||
COPY_SCALAR_FIELD(do_initial_prune);
|
||||
COPY_SCALAR_FIELD(do_exec_prune);
|
||||
COPY_BITMAPSET_FIELD(execparamids);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyPartitionPruneStepOp
|
||||
*/
|
||||
static PartitionPruneStepOp *
|
||||
_copyPartitionPruneStepOp(const PartitionPruneStepOp *from)
|
||||
{
|
||||
PartitionPruneStepOp *newnode = makeNode(PartitionPruneStepOp);
|
||||
|
||||
COPY_SCALAR_FIELD(step.step_id);
|
||||
COPY_SCALAR_FIELD(opstrategy);
|
||||
COPY_NODE_FIELD(exprs);
|
||||
COPY_NODE_FIELD(cmpfns);
|
||||
COPY_BITMAPSET_FIELD(nullkeys);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyPartitionPruneStepCombine
|
||||
*/
|
||||
static PartitionPruneStepCombine *
|
||||
_copyPartitionPruneStepCombine(const PartitionPruneStepCombine *from)
|
||||
{
|
||||
PartitionPruneStepCombine *newnode = makeNode(PartitionPruneStepCombine);
|
||||
|
||||
COPY_SCALAR_FIELD(step.step_id);
|
||||
COPY_SCALAR_FIELD(combineOp);
|
||||
COPY_NODE_FIELD(source_stepids);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyPlanInvalItem
|
||||
*/
|
||||
@ -2134,58 +2186,6 @@ _copyOnConflictExpr(const OnConflictExpr *from)
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyPartitionPruneStepOp
|
||||
*/
|
||||
static PartitionPruneStepOp *
|
||||
_copyPartitionPruneStepOp(const PartitionPruneStepOp *from)
|
||||
{
|
||||
PartitionPruneStepOp *newnode = makeNode(PartitionPruneStepOp);
|
||||
|
||||
COPY_SCALAR_FIELD(step.step_id);
|
||||
COPY_SCALAR_FIELD(opstrategy);
|
||||
COPY_NODE_FIELD(exprs);
|
||||
COPY_NODE_FIELD(cmpfns);
|
||||
COPY_BITMAPSET_FIELD(nullkeys);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/*
|
||||
* _copyPartitionPruneStepCombine
|
||||
*/
|
||||
static PartitionPruneStepCombine *
|
||||
_copyPartitionPruneStepCombine(const PartitionPruneStepCombine *from)
|
||||
{
|
||||
PartitionPruneStepCombine *newnode = makeNode(PartitionPruneStepCombine);
|
||||
|
||||
COPY_SCALAR_FIELD(step.step_id);
|
||||
COPY_SCALAR_FIELD(combineOp);
|
||||
COPY_NODE_FIELD(source_stepids);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
static PartitionPruneInfo *
|
||||
_copyPartitionPruneInfo(const PartitionPruneInfo *from)
|
||||
{
|
||||
PartitionPruneInfo *newnode = makeNode(PartitionPruneInfo);
|
||||
|
||||
COPY_SCALAR_FIELD(reloid);
|
||||
COPY_NODE_FIELD(pruning_steps);
|
||||
COPY_BITMAPSET_FIELD(present_parts);
|
||||
COPY_SCALAR_FIELD(nparts);
|
||||
COPY_SCALAR_FIELD(nexprs);
|
||||
COPY_POINTER_FIELD(subnode_map, from->nparts * sizeof(int));
|
||||
COPY_POINTER_FIELD(subpart_map, from->nparts * sizeof(int));
|
||||
COPY_POINTER_FIELD(hasexecparam, from->nexprs * sizeof(bool));
|
||||
COPY_SCALAR_FIELD(do_initial_prune);
|
||||
COPY_SCALAR_FIELD(do_exec_prune);
|
||||
COPY_BITMAPSET_FIELD(execparamids);
|
||||
|
||||
return newnode;
|
||||
}
|
||||
|
||||
/* ****************************************************************
|
||||
* relation.h copy functions
|
||||
*
|
||||
@ -4904,6 +4904,15 @@ copyObjectImpl(const void *from)
|
||||
case T_PlanRowMark:
|
||||
retval = _copyPlanRowMark(from);
|
||||
break;
|
||||
case T_PartitionPruneInfo:
|
||||
retval = _copyPartitionPruneInfo(from);
|
||||
break;
|
||||
case T_PartitionPruneStepOp:
|
||||
retval = _copyPartitionPruneStepOp(from);
|
||||
break;
|
||||
case T_PartitionPruneStepCombine:
|
||||
retval = _copyPartitionPruneStepCombine(from);
|
||||
break;
|
||||
case T_PlanInvalItem:
|
||||
retval = _copyPlanInvalItem(from);
|
||||
break;
|
||||
@ -5064,12 +5073,6 @@ copyObjectImpl(const void *from)
|
||||
case T_OnConflictExpr:
|
||||
retval = _copyOnConflictExpr(from);
|
||||
break;
|
||||
case T_PartitionPruneStepOp:
|
||||
retval = _copyPartitionPruneStepOp(from);
|
||||
break;
|
||||
case T_PartitionPruneStepCombine:
|
||||
retval = _copyPartitionPruneStepCombine(from);
|
||||
break;
|
||||
|
||||
/*
|
||||
* RELATION NODES
|
||||
@ -5092,9 +5095,6 @@ copyObjectImpl(const void *from)
|
||||
case T_PlaceHolderInfo:
|
||||
retval = _copyPlaceHolderInfo(from);
|
||||
break;
|
||||
case T_PartitionPruneInfo:
|
||||
retval = _copyPartitionPruneInfo(from);
|
||||
break;
|
||||
|
||||
/*
|
||||
* VALUE NODES
|
||||
|
Reference in New Issue
Block a user