@@ -462,7 +462,7 @@ startScanEntry(RumState * rumstate, RumScanEntry entry)
462462
463463if (entry -> isPartialMatch ||
464464(entry -> queryCategory == RUM_CAT_EMPTY_QUERY &&
465- entry -> searchMode != GIN_SEARCH_MODE_EVERYTHING ))
465+ ! entry -> scanWithAddInfo ))
466466{
467467/*
468468 * btreeEntry.findItem locates the first item >= given search key.
@@ -500,7 +500,7 @@ startScanEntry(RumState * rumstate, RumScanEntry entry)
500500}
501501else if (btreeEntry .findItem (& btreeEntry ,stackEntry )||
502502 (entry -> queryCategory == RUM_CAT_EMPTY_QUERY &&
503- entry -> searchMode == GIN_SEARCH_MODE_EVERYTHING ))
503+ entry -> scanWithAddInfo ))
504504{
505505IndexTuple itup = (IndexTuple )PageGetItem (page ,PageGetItemId (page ,stackEntry -> off ));
506506
@@ -572,7 +572,7 @@ startScanEntry(RumState * rumstate, RumScanEntry entry)
572572}
573573
574574if (entry -> queryCategory == RUM_CAT_EMPTY_QUERY &&
575- entry -> searchMode == GIN_SEARCH_MODE_EVERYTHING )
575+ entry -> scanWithAddInfo )
576576entry -> stack = stackEntry ;
577577}
578578
@@ -850,7 +850,6 @@ entryGetNextItemList(RumState * rumstate, RumScanEntry entry)
850850pfree (entry -> list );
851851entry -> list = NULL ;
852852entry -> nlist = 0 ;
853- entry -> nalloc = 0 ;
854853}
855854entry -> matchBitmap = NULL ;
856855entry -> matchResult = NULL ;
@@ -2551,11 +2550,19 @@ rumgettuple(IndexScanDesc scan, ScanDirection direction)
25512550}
25522551
25532552item = rum_tuplesort_getrum (so -> sortstate , true,& should_free );
2554- if (item )
2553+ while (item )
25552554{
25562555uint32 i ,
25572556j = 0 ;
25582557
2558+ if (rumCompareItemPointers (& scan -> xs_ctup .t_self ,& item -> iptr )== 0 )
2559+ {
2560+ if (should_free )
2561+ pfree (item );
2562+ item = rum_tuplesort_getrum (so -> sortstate , true,& should_free );
2563+ continue ;
2564+ }
2565+
25592566scan -> xs_ctup .t_self = item -> iptr ;
25602567scan -> xs_recheck = item -> recheck ;
25612568scan -> xs_recheckorderby = false;
@@ -2574,8 +2581,6 @@ rumgettuple(IndexScanDesc scan, ScanDirection direction)
25742581pfree (item );
25752582PG_RETURN_BOOL (true);
25762583}
2577- else
2578- {
2579- PG_RETURN_BOOL (false);
2580- }
2584+
2585+ PG_RETURN_BOOL (false);
25812586}