From: Heikki Linnakangas Date: Tue, 22 Apr 2014 12:34:54 +0000 (+0300) Subject: Fix bug in new B-tree page deletion code. X-Git-Tag: REL9_4_BETA1~135 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=77fe2b6d795f3f4ed282c9c980920e128a57624e;p=postgresql Fix bug in new B-tree page deletion code. When modifying a page, must hold an exclusive lock. A shared lock is obviously not good enough. --- diff --git a/src/backend/access/nbtree/nbtpage.c b/src/backend/access/nbtree/nbtpage.c index 87ac5f4aaf..b95c1b886d 100644 --- a/src/backend/access/nbtree/nbtpage.c +++ b/src/backend/access/nbtree/nbtpage.c @@ -996,7 +996,7 @@ _bt_lock_branch_parent(Relation rel, BlockNumber child, BTStack stack, /* Locate the parent's downlink (updating the stack entry if needed) */ ItemPointerSet(&(stack->bts_btentry.t_tid), child, P_HIKEY); - pbuf = _bt_getstackbuf(rel, stack, BT_READ); + pbuf = _bt_getstackbuf(rel, stack, BT_WRITE); if (pbuf == InvalidBuffer) elog(ERROR, "failed to re-find parent key in index \"%s\" for deletion target page %u", RelationGetRelationName(rel), child);