Commit 401293fc authored by Vadim B. Mikheev's avatar Vadim B. Mikheev

Unique btree-s:

/*
 * Have to check is inserted heap tuple deleted one
 * (i.e. just moved to another place by vacuum)!
 */
parent a2c96a16
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
* *
* *
* IDENTIFICATION * IDENTIFICATION
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.36 1999/03/28 20:31:56 vadim Exp $ * $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.37 1999/04/12 16:56:08 vadim Exp $
* *
*------------------------------------------------------------------------- *-------------------------------------------------------------------------
*/ */
...@@ -100,11 +100,12 @@ l1: ...@@ -100,11 +100,12 @@ l1:
if (!PageIsEmpty(page) && offset <= maxoff) if (!PageIsEmpty(page) && offset <= maxoff)
{ {
TupleDesc itupdesc; TupleDesc itupdesc;
BTItem btitem; BTItem cbti;
HeapTupleData htup; HeapTupleData htup;
BTPageOpaque opaque; BTPageOpaque opaque;
Buffer nbuf; Buffer nbuf;
BlockNumber blkno; BlockNumber blkno;
bool chtup = true;
itupdesc = RelationGetDescr(rel); itupdesc = RelationGetDescr(rel);
nbuf = InvalidBuffer; nbuf = InvalidBuffer;
...@@ -121,9 +122,23 @@ l1: ...@@ -121,9 +122,23 @@ l1:
*/ */
while (_bt_isequal(itupdesc, page, offset, natts, itup_scankey)) while (_bt_isequal(itupdesc, page, offset, natts, itup_scankey))
{ /* they're equal */ { /* they're equal */
btitem = (BTItem) PageGetItem(page, PageGetItemId(page, offset)); /*
* Have to check is inserted heap tuple deleted one
* (i.e. just moved to another place by vacuum)!
*/
if (chtup)
{
htup.t_self = btitem->bti_itup.t_tid; htup.t_self = btitem->bti_itup.t_tid;
heap_fetch(heapRel, SnapshotDirty, &htup, &buffer); heap_fetch(heapRel, SnapshotDirty, &htup, &buffer);
if (htup.t_data == NULL) /* YES! */
break;
/* Live tuple was inserted */
ReleaseBuffer(buffer);
chtup = false;
}
cbti = (BTItem) PageGetItem(page, PageGetItemId(page, offset));
htup.t_self = cbti->bti_itup.t_tid;
heap_fetch(heapRel, SnapshotDirty, &htup, &buffer);
if (htup.t_data != NULL) /* it is a duplicate */ if (htup.t_data != NULL) /* it is a duplicate */
{ {
TransactionId xwait = TransactionId xwait =
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment