Fix longstanding bug found by Atsushi Ogawa: _bt_check_unique would mark

the wrong buffer dirty when trying to kill a dead index entry that's on
a page after the one it started on.  No risk of data corruption, just
inefficiency, but still a bug.
This commit is contained in:
Tom Lane 2005-10-12 17:18:03 +00:00
parent fa72121594
commit e952ae1268
1 changed files with 5 additions and 2 deletions

View File

@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.125 2005/09/24 22:54:35 tgl Exp $
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.126 2005/10/12 17:18:03 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@ -261,7 +261,10 @@ _bt_check_unique(Relation rel, BTItem btitem, Relation heapRel,
hbuffer) == HEAPTUPLE_DEAD)
{
curitemid->lp_flags |= LP_DELETE;
SetBufferCommitInfoNeedsSave(buf);
if (nbuf != InvalidBuffer)
SetBufferCommitInfoNeedsSave(nbuf);
else
SetBufferCommitInfoNeedsSave(buf);
}
LockBuffer(hbuffer, BUFFER_LOCK_UNLOCK);
}