From 546dd54a77a190d104bc79bfdb016bc23948bd86 Mon Sep 17 00:00:00 2001 From: Hari Date: Fri, 9 Jun 2017 11:38:36 +1000 Subject: [PATCH 09/10] Remaining heap_insert calls repalce --- src/backend/commands/createas.c | 26 +++++++++++++------------- src/backend/commands/matview.c | 21 ++++++++++----------- 2 files changed, 23 insertions(+), 24 deletions(-) diff --git a/src/backend/commands/createas.c b/src/backend/commands/createas.c index 06425cc..d0d167a 100644 --- a/src/backend/commands/createas.c +++ b/src/backend/commands/createas.c @@ -26,6 +26,7 @@ #include "access/reloptions.h" #include "access/htup_details.h" +#include "access/storageamapi.h" #include "access/sysattr.h" #include "access/xact.h" #include "access/xlog.h" @@ -582,25 +583,24 @@ static bool intorel_receive(TupleTableSlot *slot, DestReceiver *self) { DR_intorel *myState = (DR_intorel *) self; - HeapTuple tuple; + StorageAmRoutine *method; + ItemPointerData iptr; - /* - * get the heap tuple out of the tuple table slot, making sure we have a - * writable copy - */ - tuple = ExecMaterializeSlot(slot); + ExecMaterializeSlot(slot); + method = myState->rel->rd_stamroutine; /* * force assignment of new OID (see comments in ExecInsert) */ if (myState->rel->rd_rel->relhasoids) - HeapTupleSetOid(tuple, InvalidOid); - - heap_insert(myState->rel, - tuple, - myState->output_cid, - myState->hi_options, - myState->bistate); + slot->tts_tupleOid = InvalidOid; + + method->tuple_insert(myState->rel, + slot, + myState->output_cid, + myState->hi_options, + myState->bistate, + &iptr); /* We know this is a newly created relation, so there are no indexes */ diff --git a/src/backend/commands/matview.c b/src/backend/commands/matview.c index 9ffd91e..1fb94d7 100644 --- a/src/backend/commands/matview.c +++ b/src/backend/commands/matview.c @@ -16,6 +16,7 @@ #include "access/htup_details.h" #include "access/multixact.h" +#include "access/storageamapi.h" #include "access/xact.h" #include "access/xlog.h" #include "catalog/catalog.h" @@ -491,19 +492,17 @@ static bool transientrel_receive(TupleTableSlot *slot, DestReceiver *self) { DR_transientrel *myState = (DR_transientrel *) self; - HeapTuple tuple; + StorageAmRoutine *method; + ItemPointerData iptr; - /* - * get the heap tuple out of the tuple table slot, making sure we have a - * writable copy - */ - tuple = ExecMaterializeSlot(slot); + method = myState->transientrel->rd_stamroutine; - heap_insert(myState->transientrel, - tuple, - myState->output_cid, - myState->hi_options, - myState->bistate); + method->tuple_insert(myState->transientrel, + slot, + myState->output_cid, + myState->hi_options, + myState->bistate, + &iptr); /* We know this is a newly created relation, so there are no indexes */ -- 2.7.4.windows.1