Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 55d015b

Browse filesBrowse files
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.
1 parent 3146f52 commit 55d015b
Copy full SHA for 55d015b

File tree

Expand file treeCollapse file tree

1 file changed

+5
-3
lines changed
Filter options
Expand file treeCollapse file tree

1 file changed

+5
-3
lines changed

‎src/backend/access/nbtree/nbtsearch.c

Copy file name to clipboardExpand all lines: src/backend/access/nbtree/nbtsearch.c
+5-3Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -347,12 +347,14 @@ _bt_binsrch(Relation rel,
347347
int32 result,
348348
cmpval;
349349

350-
/* Requesting nextkey semantics while using scantid seems nonsensical */
351-
Assert(!key->nextkey || key->scantid == NULL);
352-
353350
page = BufferGetPage(buf);
354351
opaque = (BTPageOpaque) PageGetSpecialPointer(page);
355352

353+
/* Requesting nextkey semantics while using scantid seems nonsensical */
354+
Assert(!key->nextkey || key->scantid == NULL);
355+
/* scantid-set callers must use _bt_binsrch_insert() on leaf pages */
356+
Assert(!P_ISLEAF(opaque) || key->scantid == NULL);
357+
356358
low = P_FIRSTDATAKEY(opaque);
357359
high = PageGetMaxOffsetNumber(page);
358360

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.