From 04298459b514495a8f1ef269b7a43c2ff3a50710 Mon Sep 17 00:00:00 2001 From: Alvaro Herrera Date: Mon, 14 Feb 2011 14:48:40 -0300 Subject: [PATCH 1/2] Fix visibility bug and poorly worded comment per Noah Misch --- src/backend/access/heap/heapam.c | 9 ++++++--- 1 files changed, 6 insertions(+), 3 deletions(-) diff --git a/src/backend/access/heap/heapam.c b/src/backend/access/heap/heapam.c index 7515dc8..5d5ccbf 100644 --- a/src/backend/access/heap/heapam.c +++ b/src/backend/access/heap/heapam.c @@ -2644,10 +2644,11 @@ l2: newtup->t_data->t_infomask |= (oldtup.t_data->t_infomask & (HEAP_XMAX_IS_MULTI | HEAP_XMAX_KEY_LOCK)); + /* - * we also need to copy the combo CID stuff, but only if the original - * tuple was created by us; otherwise the combocid module complains - * (Alternatively we could use HeapTupleHeaderGetRawCommandId) + * If the tuple was created in this transaction, and we're going to + * delete it, then it must have a combo-cid, which we need to preserve. + * Otherwise, just use the passed cid. */ if (TransactionIdIsCurrentTransactionId(HeapTupleHeaderGetXmin(oldtup.t_data))) { @@ -2656,6 +2657,8 @@ l2: HeapTupleHeaderSetCmin(newtup->t_data, HeapTupleHeaderGetCmin(oldtup.t_data)); } + else + HeapTupleHeaderSetCmin(newtup->t_data, cid); } else -- 1.7.2.3