Skip to content

Commit e3ab0be

Browse files
committed
make right initialization of firstCall and correct cleanup of sortstate
1 parent 1a4070e commit e3ab0be

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

rumget.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2335,14 +2335,12 @@ reverseScan(IndexScanDesc scan)
23352335
{
23362336
RumScanKey key = so->keys[i];
23372337

2338-
key->isFinished = false;
23392338
key->scanDirection = - key->scanDirection;
23402339

23412340
for(j=0; j<key->nentries; j++)
23422341
{
23432342
RumScanEntry entry = key->scanEntry[j];
23442343

2345-
entry->isFinished = false;
23462344
entry->scanDirection = - entry->scanDirection;
23472345
}
23482346
}
@@ -2366,9 +2364,12 @@ rumgettuple(IndexScanDesc scan, ScanDirection direction)
23662364
if (RumIsNewKey(scan))
23672365
rumNewScanKey(scan);
23682366

2367+
so->firstCall = false;
2368+
23692369
if (RumIsVoidRes(scan))
23702370
PG_RETURN_INT64(0);
23712371

2372+
23722373
startScan(scan);
23732374
if (so->naturalOrder == NoMovementScanDirection)
23742375
{

rumscan.c

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -299,6 +299,12 @@ freeScanKeys(RumScanOpaque so)
299299
so->entries = NULL;
300300
so->sortedEntries = NULL;
301301
so->totalentries = 0;
302+
303+
if (so->sortstate)
304+
{
305+
rum_tuplesort_end(so->sortstate);
306+
so->sortstate = NULL;
307+
}
302308
}
303309

304310
static void
@@ -516,7 +522,6 @@ rumNewScanKey(IndexScanDesc scan)
516522
so->secondPass = false;
517523
so->tbm = NULL;
518524
so->entriesIncrIndex = -1;
519-
so->firstCall = false;
520525
so->norderbys = scan->numberOfOrderBys;
521526

522527
/*
@@ -693,12 +698,6 @@ rumrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys,
693698
if (orderbys && scan->numberOfOrderBys > 0)
694699
memmove(scan->orderByData, orderbys,
695700
scan->numberOfOrderBys * sizeof(ScanKeyData));
696-
697-
if (so->sortstate)
698-
{
699-
rum_tuplesort_end(so->sortstate);
700-
so->sortstate = NULL;
701-
}
702701
}
703702

704703
void

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy