@@ -2044,13 +2044,24 @@ bool vertex_index_fetch_tuple(struct IndexFetchTableData *scan,
20442044 * according to `snapshot`. If a tuple was found and passed the visibility
20452045 * test, returns true, false otherwise.
20462046 */
2047- bool vertex_tuple_fetch_row_version (Relation rel , ItemPointer tid ,
2047+ bool vertex_tuple_fetch_row_version (Relation relation , ItemPointer tid ,
20482048 Snapshot snapshot , TupleTableSlot * slot ) {
2049- ereport (ERROR , (errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
2050- errmsg_internal ("vertex_parallelscan_reinitialize not implemented" )));
2051-
2049+ BufferHeapTupleTableSlot * bslot = (BufferHeapTupleTableSlot * ) slot ;
2050+ Buffer buffer ;
20522051
2053- return false;
2052+ Assert (TTS_IS_BUFFERTUPLE (slot ));
2053+
2054+ bslot -> base .tupdata .t_self = * tid ;
2055+ if (heap_fetch (relation , snapshot , & bslot -> base .tupdata , & buffer ))
2056+ {
2057+ /* store in slot, transferring existing pin */
2058+ ExecStorePinnedBufferHeapTuple (& bslot -> base .tupdata , slot , buffer );
2059+ slot -> tts_tableOid = RelationGetRelid (relation );
2060+
2061+ return true;
2062+ }
2063+
2064+ return false;
20542065}
20552066
20562067/*
@@ -2569,16 +2580,37 @@ TM_Result vertex_tuple_delete(Relation relation, ItemPointer tid, CommandId cid,
25692580}
25702581
25712582/* see table_tuple_update() for reference about parameters */
2572- TM_Result vertex_tuple_update (Relation rel , ItemPointer otid , TupleTableSlot * slot ,
2583+ TM_Result vertex_tuple_update (Relation relation , ItemPointer otid , TupleTableSlot * slot ,
25732584 CommandId cid , Snapshot snapshot , Snapshot crosscheck ,
25742585 bool wait , TM_FailureData * tmfd , LockTupleMode * lockmode ,
25752586 bool * update_indexes ) {
25762587
2577- ereport (ERROR , (errcode (ERRCODE_FEATURE_NOT_SUPPORTED ),
2578- errmsg_internal ("vertex_parallelscan_reinitialize not implemented" )));
2579-
2588+ bool shouldFree = true;
2589+ HeapTuple tuple = ExecFetchSlotHeapTuple (slot , true, & shouldFree );
2590+ TM_Result result ;
2591+
2592+ /* Update the tuple with table oid */
2593+ slot -> tts_tableOid = RelationGetRelid (relation );
2594+ tuple -> t_tableOid = slot -> tts_tableOid ;
2595+
2596+ result = heap_update (relation , otid , tuple , cid , crosscheck , wait ,
2597+ tmfd , lockmode );
2598+ ItemPointerCopy (& tuple -> t_self , & slot -> tts_tid );
2599+
2600+ /*
2601+ * Decide whether new index entries are needed for the tuple
2602+ *
2603+ * Note: heap_update returns the tid (location) of the new tuple in the
2604+ * t_self field.
2605+ *
2606+ * If it's a HOT update, we mustn't insert new index entries.
2607+ */
2608+ * update_indexes = result == TM_Ok && !HeapTupleIsHeapOnly (tuple );
2609+
2610+ if (shouldFree )
2611+ pfree (tuple );
25802612
2581- return 0 ;
2613+ return result ;
25822614}
25832615
25842616/* see table_tuple_lock() for reference about parameters */
0 commit comments