@@ -462,7 +462,7 @@ startScanEntry(RumState * rumstate, RumScanEntry entry)
462
462
463
463
if (entry -> isPartialMatch ||
464
464
(entry -> queryCategory == RUM_CAT_EMPTY_QUERY &&
465
- entry -> searchMode != GIN_SEARCH_MODE_EVERYTHING ))
465
+ ! entry -> scanWithAddInfo ))
466
466
{
467
467
/*
468
468
* btreeEntry.findItem locates the first item >= given search key.
@@ -500,7 +500,7 @@ startScanEntry(RumState * rumstate, RumScanEntry entry)
500
500
}
501
501
else if (btreeEntry .findItem (& btreeEntry ,stackEntry )||
502
502
(entry -> queryCategory == RUM_CAT_EMPTY_QUERY &&
503
- entry -> searchMode == GIN_SEARCH_MODE_EVERYTHING ))
503
+ entry -> scanWithAddInfo ))
504
504
{
505
505
IndexTuple itup = (IndexTuple )PageGetItem (page ,PageGetItemId (page ,stackEntry -> off ));
506
506
@@ -572,7 +572,7 @@ startScanEntry(RumState * rumstate, RumScanEntry entry)
572
572
}
573
573
574
574
if (entry -> queryCategory == RUM_CAT_EMPTY_QUERY &&
575
- entry -> searchMode == GIN_SEARCH_MODE_EVERYTHING )
575
+ entry -> scanWithAddInfo )
576
576
entry -> stack = stackEntry ;
577
577
}
578
578
@@ -850,7 +850,6 @@ entryGetNextItemList(RumState * rumstate, RumScanEntry entry)
850
850
pfree (entry -> list );
851
851
entry -> list = NULL ;
852
852
entry -> nlist = 0 ;
853
- entry -> nalloc = 0 ;
854
853
}
855
854
entry -> matchBitmap = NULL ;
856
855
entry -> matchResult = NULL ;
@@ -2551,11 +2550,19 @@ rumgettuple(IndexScanDesc scan, ScanDirection direction)
2551
2550
}
2552
2551
2553
2552
item = rum_tuplesort_getrum (so -> sortstate , true,& should_free );
2554
- if (item )
2553
+ while (item )
2555
2554
{
2556
2555
uint32 i ,
2557
2556
j = 0 ;
2558
2557
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
+
2559
2566
scan -> xs_ctup .t_self = item -> iptr ;
2560
2567
scan -> xs_recheck = item -> recheck ;
2561
2568
scan -> xs_recheckorderby = false;
@@ -2574,8 +2581,6 @@ rumgettuple(IndexScanDesc scan, ScanDirection direction)
2574
2581
pfree (item );
2575
2582
PG_RETURN_BOOL (true);
2576
2583
}
2577
- else
2578
- {
2579
- PG_RETURN_BOOL (false);
2580
- }
2584
+
2585
+ PG_RETURN_BOOL (false);
2581
2586
}