Skip to content

Commit 5d0122d

Browse files
author
Artur Zakirov
committed
Little fix for orderby
1 parent a63255b commit 5d0122d

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

rumscan.c

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -324,10 +324,10 @@ initScanKey(RumScanOpaque so, ScanKey skey, bool *hasNullQuery)
324324
PointerGetDatum(&searchMode)));
325325

326326
/*
327-
* If bogus searchMode is returned, treat as RUM_SEARCH_MODE_ALL; note
328-
* in particular we don't allow extractQueryFn to select
329-
* RUM_SEARCH_MODE_EVERYTHING.
330-
*/
327+
* If bogus searchMode is returned, treat as RUM_SEARCH_MODE_ALL; note
328+
* in particular we don't allow extractQueryFn to select
329+
* RUM_SEARCH_MODE_EVERYTHING.
330+
*/
331331
if (searchMode < GIN_SEARCH_MODE_DEFAULT ||
332332
searchMode > GIN_SEARCH_MODE_ALL)
333333
searchMode = GIN_SEARCH_MODE_ALL;
@@ -337,8 +337,8 @@ initScanKey(RumScanOpaque so, ScanKey skey, bool *hasNullQuery)
337337
*hasNullQuery = true;
338338

339339
/*
340-
* In default mode, no keys means an unsatisfiable query.
341-
*/
340+
* In default mode, no keys means an unsatisfiable query.
341+
*/
342342
if (queryValues == NULL || nQueryValues <= 0)
343343
{
344344
if (searchMode == GIN_SEARCH_MODE_DEFAULT)
@@ -350,12 +350,12 @@ initScanKey(RumScanOpaque so, ScanKey skey, bool *hasNullQuery)
350350
}
351351

352352
/*
353-
* If the extractQueryFn didn't create a nullFlags array, create one,
354-
* assuming that everything's non-null. Otherwise, run through the
355-
* array and make sure each value is exactly 0 or 1; this ensures
356-
* binary compatibility with the RumNullCategory representation. While
357-
* at it, detect whether any null keys are present.
358-
*/
353+
* If the extractQueryFn didn't create a nullFlags array, create one,
354+
* assuming that everything's non-null. Otherwise, run through the
355+
* array and make sure each value is exactly 0 or 1; this ensures
356+
* binary compatibility with the RumNullCategory representation. While
357+
* at it, detect whether any null keys are present.
358+
*/
359359
if (nullFlags == NULL)
360360
nullFlags = (bool *) palloc0(nQueryValues * sizeof(bool));
361361
else
@@ -463,12 +463,11 @@ rumrescan(IndexScanDesc scan, ScanKey scankey, int nscankeys,
463463
freeScanKeys(so);
464464

465465
if (scankey && scan->numberOfKeys > 0)
466-
{
467466
memmove(scan->keyData, scankey,
468467
scan->numberOfKeys * sizeof(ScanKeyData));
468+
if (orderbys && scan->numberOfOrderBys > 0)
469469
memmove(scan->orderByData, orderbys,
470470
scan->numberOfOrderBys * sizeof(ScanKeyData));
471-
}
472471

473472
if (so->sortstate)
474473
{

0 commit comments

Comments
 (0)