diff options
author | Robert Haas <rhaas@postgresql.org> | 2017-10-12 16:50:53 -0400 |
---|---|---|
committer | Robert Haas <rhaas@postgresql.org> | 2017-10-12 16:50:53 -0400 |
commit | 60f7c0abef0327648c02795312d1679c66586fbb (patch) | |
tree | 8f3bcc629324e6f338cceea686e9d498691c7a55 /src/backend/executor/execMain.c | |
parent | 305cf1fd7239e0ffa9ae4ff54a7c66f36432c741 (diff) | |
download | postgresql-60f7c0abef0327648c02795312d1679c66586fbb.tar.gz postgresql-60f7c0abef0327648c02795312d1679c66586fbb.zip |
Use ResultRelInfo ** rather than ResultRelInfo * for tuple routing.
The previous convention doesn't lend itself to creating ResultRelInfos
lazily, as we already do in ExecGetTriggerResultRel. This patch
doesn't make anything lazier than before, but the pending patch for
UPDATE tuple routing proposes to do so (and there might be other
opportunities as well).
Amit Khandekar with some adjustments by me.
Discussion: http://postgr.es/m/CA+TgmoYPVP9Lyf6vUFA5DwxS4c--x6LOj2y36BsJaYtp62eXPQ@mail.gmail.com
Diffstat (limited to 'src/backend/executor/execMain.c')
-rw-r--r-- | src/backend/executor/execMain.c | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/src/backend/executor/execMain.c b/src/backend/executor/execMain.c index 8359beb463a..96894299122 100644 --- a/src/backend/executor/execMain.c +++ b/src/backend/executor/execMain.c @@ -3242,7 +3242,7 @@ EvalPlanQualEnd(EPQState *epqstate) * Output arguments: * 'pd' receives an array of PartitionDispatch objects with one entry for * every partitioned table in the partition tree - * 'partitions' receives an array of ResultRelInfo objects with one entry for + * 'partitions' receives an array of ResultRelInfo* objects with one entry for * every leaf partition in the partition tree * 'tup_conv_maps' receives an array of TupleConversionMap objects with one * entry for every leaf partition (required to convert input tuple based @@ -3265,7 +3265,7 @@ ExecSetupPartitionTupleRouting(Relation rel, Index resultRTindex, EState *estate, PartitionDispatch **pd, - ResultRelInfo **partitions, + ResultRelInfo ***partitions, TupleConversionMap ***tup_conv_maps, TupleTableSlot **partition_tuple_slot, int *num_parted, int *num_partitions) @@ -3283,8 +3283,8 @@ ExecSetupPartitionTupleRouting(Relation rel, (void) find_all_inheritors(RelationGetRelid(rel), RowExclusiveLock, NULL); *pd = RelationGetPartitionDispatchInfo(rel, num_parted, &leaf_parts); *num_partitions = list_length(leaf_parts); - *partitions = (ResultRelInfo *) palloc(*num_partitions * - sizeof(ResultRelInfo)); + *partitions = (ResultRelInfo **) palloc(*num_partitions * + sizeof(ResultRelInfo *)); *tup_conv_maps = (TupleConversionMap **) palloc0(*num_partitions * sizeof(TupleConversionMap *)); @@ -3296,7 +3296,8 @@ ExecSetupPartitionTupleRouting(Relation rel, */ *partition_tuple_slot = MakeTupleTableSlot(); - leaf_part_rri = *partitions; + leaf_part_rri = (ResultRelInfo *) palloc0(*num_partitions * + sizeof(ResultRelInfo)); i = 0; foreach(cell, leaf_parts) { @@ -3341,7 +3342,7 @@ ExecSetupPartitionTupleRouting(Relation rel, estate->es_leaf_result_relations = lappend(estate->es_leaf_result_relations, leaf_part_rri); - leaf_part_rri++; + (*partitions)[i] = leaf_part_rri++; i++; } } |