v40-minor_refactor_moveMergedTablesRows.no_cfbot

application/octet-stream

Filename: v40-minor_refactor_moveMergedTablesRows.no_cfbot
Type: application/octet-stream
Part: 0
Message: Re: Add SPLIT PARTITION/MERGE PARTITIONS commands
diff --git a/src/backend/commands/tablecmds.c b/src/backend/commands/tablecmds.c
index b4ec6691d8f..9e1ac1e6235 100644
--- a/src/backend/commands/tablecmds.c
+++ b/src/backend/commands/tablecmds.c
@@ -22373,9 +22373,7 @@ moveMergedTablesRows(Relation rel, List *mergingPartitionsList,
 	bistate = GetBulkInsertState();
 
 	/* Create necessary tuple slot. */
-	dstslot = MakeSingleTupleTableSlot(RelationGetDescr(newPartRel),
-									   table_slot_callbacks(newPartRel));
-	ExecStoreAllNullTuple(dstslot);
+	dstslot = table_slot_create(newPartRel, NULL);
 
 	foreach(listptr, mergingPartitionsList)
 	{
@@ -22386,8 +22384,7 @@ moveMergedTablesRows(Relation rel, List *mergingPartitionsList,
 		Snapshot	snapshot;
 
 		/* Create tuple slot for new partition. */
-		srcslot = MakeSingleTupleTableSlot(RelationGetDescr(mergingPartition),
-										   table_slot_callbacks(mergingPartition));
+		srcslot = table_slot_create(mergingPartition, NULL);
 
 		/*
 		 * Map computing for moving attributes of merged partition to new
@@ -22404,8 +22401,7 @@ moveMergedTablesRows(Relation rel, List *mergingPartitionsList,
 		{
 			TupleTableSlot *insertslot;
 
-			/* Extract data from old tuple. */
-			slot_getallattrs(srcslot);
+			CHECK_FOR_INTERRUPTS();
 
 			if (tuple_map)
 			{
@@ -22414,6 +22410,8 @@ moveMergedTablesRows(Relation rel, List *mergingPartitionsList,
 			}
 			else
 			{
+				slot_getallattrs(srcslot);
+
 				/* Copy attributes directly. */
 				insertslot = dstslot;
 
@@ -22430,8 +22428,6 @@ moveMergedTablesRows(Relation rel, List *mergingPartitionsList,
 			/* Write the tuple out to the new relation. */
 			table_tuple_insert(newPartRel, insertslot, mycid,
 							   ti_options, bistate);
-
-			CHECK_FOR_INTERRUPTS();
 		}
 
 		table_endscan(scan);