diff options
author | Tom Lane <tgl@sss.pgh.pa.us> | 2018-06-10 16:30:14 -0400 |
---|---|---|
committer | Tom Lane <tgl@sss.pgh.pa.us> | 2018-06-10 16:30:14 -0400 |
commit | 939449de0e571b8c0b07674bb7095e06e93cc059 (patch) | |
tree | c0d6bd447ba9cebaccf5e4ecaa3e3c7f34a443d1 /src/backend/nodes/outfuncs.c | |
parent | 73b7f48f78d27b1baf1a6541cbaae0fe6bd6186d (diff) | |
download | postgresql-939449de0e571b8c0b07674bb7095e06e93cc059.tar.gz postgresql-939449de0e571b8c0b07674bb7095e06e93cc059.zip |
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
Diffstat (limited to 'src/backend/nodes/outfuncs.c')
-rw-r--r-- | src/backend/nodes/outfuncs.c | 124 |
1 files changed, 62 insertions, 62 deletions
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); } @@ -1011,6 +1011,58 @@ _outPlanRowMark(StringInfo str, const PlanRowMark *node) } 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) { WRITE_NODE_TYPE("PLANINVALITEM"); @@ -1695,28 +1747,6 @@ _outFromExpr(StringInfo str, const FromExpr *node) } 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) { WRITE_NODE_TYPE("ONCONFLICTEXPR"); @@ -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; |