From: Tom Lane Date: Wed, 12 Oct 2005 17:18:45 +0000 (+0000) Subject: Fix longstanding bug found by Atsushi Ogawa: _bt_check_unique would mark X-Git-Url: http://git.postgresql.org/gitweb/static/gitweb.js?a=commitdiff_plain;h=a9b46a677202a271c0f7f68618d7039d5d4d3acb;p=users%2Fbernd%2Fpostgres.git 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. --- diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c index a2c5d4d0f9..95ac64f93c 100644 --- a/src/backend/access/nbtree/nbtinsert.c +++ b/src/backend/access/nbtree/nbtinsert.c @@ -266,7 +266,10 @@ _bt_check_unique(Relation rel, BTItem btitem, Relation heapRel, HEAPTUPLE_DEAD) { curitemid->lp_flags |= LP_DELETE; - SetBufferCommitInfoNeedsSave(buf); + if (nbuf != InvalidBuffer) + SetBufferCommitInfoNeedsSave(nbuf); + else + SetBufferCommitInfoNeedsSave(buf); } if (sv_infomask != htup.t_data->t_infomask) SetBufferCommitInfoNeedsSave(hbuffer);