Skip to content

Commit e952ae1

Browse files
committed
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.
1 parent fa72121 commit e952ae1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/backend/access/nbtree/nbtinsert.c

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
*
99
*
1010
* IDENTIFICATION
11-
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.125 2005/09/24 22:54:35 tgl Exp $
11+
* $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.126 2005/10/12 17:18:03 tgl Exp $
1212
*
1313
*-------------------------------------------------------------------------
1414
*/
@@ -261,7 +261,10 @@ _bt_check_unique(Relation rel, BTItem btitem, Relation heapRel,
261261
hbuffer) == HEAPTUPLE_DEAD)
262262
{
263263
curitemid->lp_flags |= LP_DELETE;
264-
SetBufferCommitInfoNeedsSave(buf);
264+
if (nbuf != InvalidBuffer)
265+
SetBufferCommitInfoNeedsSave(nbuf);
266+
else
267+
SetBufferCommitInfoNeedsSave(buf);
265268
}
266269
LockBuffer(hbuffer, BUFFER_LOCK_UNLOCK);
267270
}

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy