Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit401293f

Browse files
committed
Unique btree-s:
/* * Have to check is inserted heap tuple deleted one * (i.e. just moved to another place by vacuum)! */
1 parenta2c96a1 commit401293f

File tree

1 file changed

+19
-4
lines changed

1 file changed

+19
-4
lines changed

‎src/backend/access/nbtree/nbtinsert.c

Lines changed: 19 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
*
88
*
99
* IDENTIFICATION
10-
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.36 1999/03/28 20:31:56 vadim Exp $
10+
* $Header: /cvsroot/pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.37 1999/04/12 16:56:08 vadim Exp $
1111
*
1212
*-------------------------------------------------------------------------
1313
*/
@@ -100,11 +100,12 @@ _bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel
100100
if (!PageIsEmpty(page)&&offset <=maxoff)
101101
{
102102
TupleDescitupdesc;
103-
BTItembtitem;
103+
BTItemcbti;
104104
HeapTupleDatahtup;
105105
BTPageOpaqueopaque;
106106
Buffernbuf;
107107
BlockNumberblkno;
108+
boolchtup= true;
108109

109110
itupdesc=RelationGetDescr(rel);
110111
nbuf=InvalidBuffer;
@@ -121,8 +122,22 @@ _bt_doinsert(Relation rel, BTItem btitem, bool index_is_unique, Relation heapRel
121122
*/
122123
while (_bt_isequal(itupdesc,page,offset,natts,itup_scankey))
123124
{/* they're equal */
124-
btitem= (BTItem)PageGetItem(page,PageGetItemId(page,offset));
125-
htup.t_self=btitem->bti_itup.t_tid;
125+
/*
126+
* Have to check is inserted heap tuple deleted one
127+
* (i.e. just moved to another place by vacuum)!
128+
*/
129+
if (chtup)
130+
{
131+
htup.t_self=btitem->bti_itup.t_tid;
132+
heap_fetch(heapRel,SnapshotDirty,&htup,&buffer);
133+
if (htup.t_data==NULL)/* YES! */
134+
break;
135+
/* Live tuple was inserted */
136+
ReleaseBuffer(buffer);
137+
chtup= false;
138+
}
139+
cbti= (BTItem)PageGetItem(page,PageGetItemId(page,offset));
140+
htup.t_self=cbti->bti_itup.t_tid;
126141
heap_fetch(heapRel,SnapshotDirty,&htup,&buffer);
127142
if (htup.t_data!=NULL)/* it is a duplicate */
128143
{

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp