From 939449de0e571b8c0b07674bb7095e06e93cc059 Mon Sep 17 00:00:00 2001 From: Tom Lane Date: Sun, 10 Jun 2018 16:30:14 -0400 Subject: 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 --- src/backend/nodes/outfuncs.c | 124 +++++++++++++++++++++---------------------- 1 file changed, 62 insertions(+), 62 deletions(-) (limited to 'src/backend/nodes/outfuncs.c') diff --git a/src/backend/nodes/outfuncs.c b/src/backend/nodes/outfuncs.c index 5895262c4a8..19879aeb463 100644 --- a/src/backend/nodes/outfuncs.c +++ b/src/backend/nodes/outfuncs.c @@ -399,9 +399,9 @@ _outAppend(StringInfo str, const Append *node) _outPlanInfo(str, (const Plan *) node); - WRITE_NODE_FIELD(partitioned_rels); WRITE_NODE_FIELD(appendplans); WRITE_INT_FIELD(first_partial_plan); + WRITE_NODE_FIELD(partitioned_rels); WRITE_NODE_FIELD(part_prune_infos); } @@ -1010,6 +1010,58 @@ _outPlanRowMark(StringInfo str, const PlanRowMark *node) WRITE_BOOL_FIELD(isParent); } +static void +_outPartitionPruneInfo(StringInfo str, const PartitionPruneInfo *node) +{ + int i; + + WRITE_NODE_TYPE("PARTITIONPRUNEINFO"); + + WRITE_OID_FIELD(reloid); + WRITE_NODE_FIELD(pruning_steps); + WRITE_BITMAPSET_FIELD(present_parts); + WRITE_INT_FIELD(nparts); + WRITE_INT_FIELD(nexprs); + + appendStringInfoString(str, " :subnode_map"); + for (i = 0; i < node->nparts; i++) + appendStringInfo(str, " %d", node->subnode_map[i]); + + appendStringInfoString(str, " :subpart_map"); + for (i = 0; i < node->nparts; i++) + appendStringInfo(str, " %d", node->subpart_map[i]); + + appendStringInfoString(str, " :hasexecparam"); + for (i = 0; i < node->nexprs; i++) + appendStringInfo(str, " %s", booltostr(node->hasexecparam[i])); + + WRITE_BOOL_FIELD(do_initial_prune); + WRITE_BOOL_FIELD(do_exec_prune); + WRITE_BITMAPSET_FIELD(execparamids); +} + +static void +_outPartitionPruneStepOp(StringInfo str, const PartitionPruneStepOp *node) +{ + WRITE_NODE_TYPE("PARTITIONPRUNESTEPOP"); + + WRITE_INT_FIELD(step.step_id); + WRITE_INT_FIELD(opstrategy); + WRITE_NODE_FIELD(exprs); + WRITE_NODE_FIELD(cmpfns); + WRITE_BITMAPSET_FIELD(nullkeys); +} + +static void +_outPartitionPruneStepCombine(StringInfo str, const PartitionPruneStepCombine *node) +{ + WRITE_NODE_TYPE("PARTITIONPRUNESTEPCOMBINE"); + + WRITE_INT_FIELD(step.step_id); + WRITE_ENUM_FIELD(combineOp, PartitionPruneCombineOp); + WRITE_NODE_FIELD(source_stepids); +} + static void _outPlanInvalItem(StringInfo str, const PlanInvalItem *node) { @@ -1694,28 +1746,6 @@ _outFromExpr(StringInfo str, const FromExpr *node) WRITE_NODE_FIELD(quals); } -static void -_outPartitionPruneStepOp(StringInfo str, const PartitionPruneStepOp *node) -{ - WRITE_NODE_TYPE("PARTITIONPRUNESTEPOP"); - - WRITE_INT_FIELD(step.step_id); - WRITE_INT_FIELD(opstrategy); - WRITE_NODE_FIELD(exprs); - WRITE_NODE_FIELD(cmpfns); - WRITE_BITMAPSET_FIELD(nullkeys); -} - -static void -_outPartitionPruneStepCombine(StringInfo str, const PartitionPruneStepCombine *node) -{ - WRITE_NODE_TYPE("PARTITIONPRUNESTEPCOMBINE"); - - WRITE_INT_FIELD(step.step_id); - WRITE_ENUM_FIELD(combineOp, PartitionPruneCombineOp); - WRITE_NODE_FIELD(source_stepids); -} - static void _outOnConflictExpr(StringInfo str, const OnConflictExpr *node) { @@ -1731,36 +1761,6 @@ _outOnConflictExpr(StringInfo str, const OnConflictExpr *node) WRITE_NODE_FIELD(exclRelTlist); } -static void -_outPartitionPruneInfo(StringInfo str, const PartitionPruneInfo *node) -{ - int i; - - WRITE_NODE_TYPE("PARTITIONPRUNEINFO"); - - WRITE_OID_FIELD(reloid); - WRITE_NODE_FIELD(pruning_steps); - WRITE_BITMAPSET_FIELD(present_parts); - WRITE_INT_FIELD(nparts); - WRITE_INT_FIELD(nexprs); - - appendStringInfoString(str, " :subnode_map"); - for (i = 0; i < node->nparts; i++) - appendStringInfo(str, " %d", node->subnode_map[i]); - - appendStringInfoString(str, " :subpart_map"); - for (i = 0; i < node->nparts; i++) - appendStringInfo(str, " %d", node->subpart_map[i]); - - appendStringInfoString(str, " :hasexecparam"); - for (i = 0; i < node->nexprs; i++) - appendStringInfo(str, " %s", booltostr(node->hasexecparam[i])); - - WRITE_BOOL_FIELD(do_initial_prune); - WRITE_BOOL_FIELD(do_exec_prune); - WRITE_BITMAPSET_FIELD(execparamids); -} - /***************************************************************************** * * Stuff from relation.h. @@ -3827,6 +3827,15 @@ outNode(StringInfo str, const void *obj) case T_PlanRowMark: _outPlanRowMark(str, obj); break; + case T_PartitionPruneInfo: + _outPartitionPruneInfo(str, obj); + break; + case T_PartitionPruneStepOp: + _outPartitionPruneStepOp(str, obj); + break; + case T_PartitionPruneStepCombine: + _outPartitionPruneStepCombine(str, obj); + break; case T_PlanInvalItem: _outPlanInvalItem(str, obj); break; @@ -3983,15 +3992,6 @@ outNode(StringInfo str, const void *obj) case T_OnConflictExpr: _outOnConflictExpr(str, obj); break; - case T_PartitionPruneStepOp: - _outPartitionPruneStepOp(str, obj); - break; - case T_PartitionPruneStepCombine: - _outPartitionPruneStepCombine(str, obj); - break; - case T_PartitionPruneInfo: - _outPartitionPruneInfo(str, obj); - break; case T_Path: _outPath(str, obj); break; -- cgit v1.2.3