mirror of
https://github.com/postgres/postgres.git
synced 2025-07-02 09:02:37 +03:00
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
This commit is contained in:
@ -167,7 +167,7 @@ typedef struct CopyStateData
|
||||
PartitionDispatch *partition_dispatch_info;
|
||||
int num_dispatch; /* Number of entries in the above array */
|
||||
int num_partitions; /* Number of members in the following arrays */
|
||||
ResultRelInfo *partitions; /* Per partition result relation */
|
||||
ResultRelInfo **partitions; /* Per partition result relation pointers */
|
||||
TupleConversionMap **partition_tupconv_maps;
|
||||
TupleTableSlot *partition_tuple_slot;
|
||||
TransitionCaptureState *transition_capture;
|
||||
@ -2459,7 +2459,7 @@ CopyFrom(CopyState cstate)
|
||||
if (cstate->rel->rd_rel->relkind == RELKIND_PARTITIONED_TABLE)
|
||||
{
|
||||
PartitionDispatch *partition_dispatch_info;
|
||||
ResultRelInfo *partitions;
|
||||
ResultRelInfo **partitions;
|
||||
TupleConversionMap **partition_tupconv_maps;
|
||||
TupleTableSlot *partition_tuple_slot;
|
||||
int num_parted,
|
||||
@ -2495,7 +2495,7 @@ CopyFrom(CopyState cstate)
|
||||
for (i = 0; i < cstate->num_partitions; ++i)
|
||||
{
|
||||
cstate->transition_tupconv_maps[i] =
|
||||
convert_tuples_by_name(RelationGetDescr(cstate->partitions[i].ri_RelationDesc),
|
||||
convert_tuples_by_name(RelationGetDescr(cstate->partitions[i]->ri_RelationDesc),
|
||||
RelationGetDescr(cstate->rel),
|
||||
gettext_noop("could not convert row type"));
|
||||
}
|
||||
@ -2626,7 +2626,7 @@ CopyFrom(CopyState cstate)
|
||||
* to the selected partition.
|
||||
*/
|
||||
saved_resultRelInfo = resultRelInfo;
|
||||
resultRelInfo = cstate->partitions + leaf_part_index;
|
||||
resultRelInfo = cstate->partitions[leaf_part_index];
|
||||
|
||||
/* We do not yet have a way to insert into a foreign partition */
|
||||
if (resultRelInfo->ri_FdwRoutine)
|
||||
@ -2856,7 +2856,7 @@ CopyFrom(CopyState cstate)
|
||||
}
|
||||
for (i = 0; i < cstate->num_partitions; i++)
|
||||
{
|
||||
ResultRelInfo *resultRelInfo = cstate->partitions + i;
|
||||
ResultRelInfo *resultRelInfo = cstate->partitions[i];
|
||||
|
||||
ExecCloseIndices(resultRelInfo);
|
||||
heap_close(resultRelInfo->ri_RelationDesc, NoLock);
|
||||
|
Reference in New Issue
Block a user