[prev] 52 [next]

Updates in Heaps (cont)

PostgreSQL tuple update:

heap_update(Relation relation,     // relation desc
            ItemPointer otid,      // old tupleID
            HeapTuple newtup, ..., // new tuple data
            CommandId cid, ...)    // SQL statement

  • essentially does delete(otid), then insert(newtup)
  • also, sets old tuple's ctid field to reference new tuple
  • can also update-in-place if no referencing transactions