summaryrefslogtreecommitdiff
path: root/src/backend/access/nbtree/nbtinsert.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/access/nbtree/nbtinsert.c')
-rw-r--r--src/backend/access/nbtree/nbtinsert.c33
1 files changed, 22 insertions, 11 deletions
diff --git a/src/backend/access/nbtree/nbtinsert.c b/src/backend/access/nbtree/nbtinsert.c
index beb543f0939..cc85592b183 100644
--- a/src/backend/access/nbtree/nbtinsert.c
+++ b/src/backend/access/nbtree/nbtinsert.c
@@ -8,7 +8,7 @@
*
*
* IDENTIFICATION
- * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.146.2.1 2007/01/27 20:53:36 tgl Exp $
+ * $PostgreSQL: pgsql/src/backend/access/nbtree/nbtinsert.c,v 1.146.2.2 2007/12/31 04:52:20 tgl Exp $
*
*-------------------------------------------------------------------------
*/
@@ -324,7 +324,7 @@ _bt_check_unique(Relation rel, IndexTuple itup, Relation heapRel,
if (!P_IGNORE(opaque))
break;
if (P_RIGHTMOST(opaque))
- elog(ERROR, "fell off the end of \"%s\"",
+ elog(ERROR, "fell off the end of index \"%s\"",
RelationGetRelationName(rel));
}
maxoff = PageGetMaxOffsetNumber(page);
@@ -496,7 +496,7 @@ _bt_insertonpg(Relation rel,
if (!P_IGNORE(lpageop))
break;
if (P_RIGHTMOST(lpageop))
- elog(ERROR, "fell off the end of \"%s\"",
+ elog(ERROR, "fell off the end of index \"%s\"",
RelationGetRelationName(rel));
}
_bt_relbuf(rel, buf);
@@ -777,7 +777,9 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
item = (IndexTuple) PageGetItem(origpage, itemid);
if (PageAddItem(rightpage, (Item) item, itemsz, rightoff,
LP_USED) == InvalidOffsetNumber)
- elog(PANIC, "failed to add hikey to the right sibling");
+ elog(PANIC, "failed to add hikey to the right sibling"
+ " while splitting block %u of index \"%s\"",
+ BufferGetBlockNumber(buf), RelationGetRelationName(rel));
rightoff = OffsetNumberNext(rightoff);
}
@@ -802,7 +804,9 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
}
if (PageAddItem(leftpage, (Item) item, itemsz, leftoff,
LP_USED) == InvalidOffsetNumber)
- elog(PANIC, "failed to add hikey to the left sibling");
+ elog(PANIC, "failed to add hikey to the left sibling"
+ " while splitting block %u of index \"%s\"",
+ BufferGetBlockNumber(buf), RelationGetRelationName(rel));
leftoff = OffsetNumberNext(leftoff);
/*
@@ -887,7 +891,10 @@ _bt_split(Relation rel, Buffer buf, OffsetNumber firstright,
spage = BufferGetPage(sbuf);
sopaque = (BTPageOpaque) PageGetSpecialPointer(spage);
if (sopaque->btpo_prev != ropaque->btpo_prev)
- elog(PANIC, "right sibling's left-link doesn't match");
+ elog(PANIC, "right sibling's left-link doesn't match: "
+ "block %u links to %u instead of expected %u in index \"%s\"",
+ ropaque->btpo_next, sopaque->btpo_prev, ropaque->btpo_prev,
+ RelationGetRelationName(rel));
/*
* Check to see if we can set the SPLIT_END flag in the right-hand
@@ -1175,7 +1182,7 @@ _bt_findsplitloc(Relation rel,
* in case ...
*/
if (!state.have_split)
- elog(ERROR, "could not find a feasible split point for \"%s\"",
+ elog(ERROR, "could not find a feasible split point for index \"%s\"",
RelationGetRelationName(rel));
*newitemonleft = state.newitemonleft;
@@ -1345,7 +1352,7 @@ _bt_insert_parent(Relation rel,
/* Check for error only after writing children */
if (pbuf == InvalidBuffer)
- elog(ERROR, "failed to re-find parent key in \"%s\" for split pages %u/%u",
+ elog(ERROR, "failed to re-find parent key in index \"%s\" for split pages %u/%u",
RelationGetRelationName(rel), bknum, rbknum);
/* Recursively update the parent */
@@ -1552,7 +1559,9 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
* benefit of _bt_restore_page().
*/
if (PageAddItem(rootpage, (Item) new_item, itemsz, P_HIKEY, LP_USED) == InvalidOffsetNumber)
- elog(PANIC, "failed to add leftkey to new root page");
+ elog(PANIC, "failed to add leftkey to new root page"
+ " while splitting block %u of index \"%s\"",
+ BufferGetBlockNumber(lbuf), RelationGetRelationName(rel));
pfree(new_item);
/*
@@ -1569,7 +1578,9 @@ _bt_newroot(Relation rel, Buffer lbuf, Buffer rbuf)
* insert the right page pointer into the new root page.
*/
if (PageAddItem(rootpage, (Item) new_item, itemsz, P_FIRSTKEY, LP_USED) == InvalidOffsetNumber)
- elog(PANIC, "failed to add rightkey to new root page");
+ elog(PANIC, "failed to add rightkey to new root page"
+ " while splitting block %u of index \"%s\"",
+ BufferGetBlockNumber(lbuf), RelationGetRelationName(rel));
pfree(new_item);
MarkBufferDirty(rootbuf);
@@ -1656,7 +1667,7 @@ _bt_pgaddtup(Relation rel,
if (PageAddItem(page, (Item) itup, itemsize, itup_off,
LP_USED) == InvalidOffsetNumber)
- elog(PANIC, "failed to add item to the %s for \"%s\"",
+ elog(PANIC, "failed to add item to the %s in index \"%s\"",
where, RelationGetRelationName(rel));
}