Commit 55d015bd authored by Peter Geoghegan's avatar Peter Geoghegan

Add _bt_binsrch() scantid assertion to nbtree.

Assert that _bt_binsrch() binary searches with scantid set in insertion
scankey cannot be performed on leaf pages.  Leaf-level binary searches
where scantid is set must use _bt_binsrch_insert() instead.

_bt_binsrch_insert() is likely to have additional responsibilities in
the future, such as searching within GIN-style posting lists using
scantid.  It seems like a good idea to tighten things up now.
parent 3146f525
......@@ -347,12 +347,14 @@ _bt_binsrch(Relation rel,
int32 result,
cmpval;
/* Requesting nextkey semantics while using scantid seems nonsensical */
Assert(!key->nextkey || key->scantid == NULL);
page = BufferGetPage(buf);
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
/* Requesting nextkey semantics while using scantid seems nonsensical */
Assert(!key->nextkey || key->scantid == NULL);
/* scantid-set callers must use _bt_binsrch_insert() on leaf pages */
Assert(!P_ISLEAF(opaque) || key->scantid == NULL);
low = P_FIRSTDATAKEY(opaque);
high = PageGetMaxOffsetNumber(page);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment