Remove overzealous _bt_split() assertions.
authorPeter Geoghegan <pg@bowt.ie>
Tue, 3 Mar 2020 05:40:11 +0000 (21:40 -0800)
committerPeter Geoghegan <pg@bowt.ie>
Tue, 3 Mar 2020 05:40:11 +0000 (21:40 -0800)
_bt_split() is passed NULL as its insertion scankey for internal page
splits.  Two recently added Assert() statements failed to consider this,
leading to a crash with pg_upgrade'd BREE_VERSION < 4 indexes.  Remove
the assertions.

The assertions in question were added by commit 0d861bbb, which added
nbtree deduplication.  It would be possible to fix the assertions
directly instead, but they weren't adding much anyway.

src/backend/access/nbtree/nbtinsert.c

index f3f3d971aa45ae70bb5b1bc24ae4c819db018dbb..03b7e45293a3e5959de7322f2df591a0efea9adc 100644 (file)
@@ -1632,7 +1632,6 @@ _bt_split(Relation rel, BTScanInsert itup_key, Buffer buf, Buffer cbuf,
         */
        leftoff = P_HIKEY;
 
-       Assert(BTreeTupleIsPivot(lefthikey) || !itup_key->heapkeyspace);
        Assert(BTreeTupleGetNAtts(lefthikey, rel) > 0);
        Assert(BTreeTupleGetNAtts(lefthikey, rel) <= indnkeyatts);
        if (PageAddItem(leftpage, (Item) lefthikey, itemsz, leftoff,
@@ -1697,7 +1696,6 @@ _bt_split(Relation rel, BTScanInsert itup_key, Buffer buf, Buffer cbuf,
                itemid = PageGetItemId(origpage, P_HIKEY);
                itemsz = ItemIdGetLength(itemid);
                item = (IndexTuple) PageGetItem(origpage, itemid);
-               Assert(BTreeTupleIsPivot(item) || !itup_key->heapkeyspace);
                Assert(BTreeTupleGetNAtts(item, rel) > 0);
                Assert(BTreeTupleGetNAtts(item, rel) <= indnkeyatts);
                if (PageAddItem(rightpage, (Item) item, itemsz, rightoff,