Movatterモバイル変換


[0]ホーム

URL:


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

Sign up
Appearance settings

Commitc380a0d

Browse files
committed
Prevent ORDER BY for partial match
1 parent6291a92 commitc380a0d

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

‎rumget.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,7 @@ callConsistentFn(RumState * rumstate, RumScanKey key)
9797

9898
for (i=0;i<key->nentries;i++)
9999
{
100-
if (key->entryRes[i]&&key->addInfoIsNull[0]== false)
100+
if (key->entryRes[i]&&key->addInfoIsNull[i]== false)
101101
{
102102
key->outerAddInfoIsNull= false;
103103

‎rumscan.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -302,7 +302,8 @@ freeScanKeys(RumScanOpaque so)
302302
}
303303

304304
staticvoid
305-
initScanKey(RumScanOpaqueso,ScanKeyskey,bool*hasNullQuery)
305+
initScanKey(RumScanOpaqueso,ScanKeyskey,bool*hasNullQuery,
306+
bool*hasPartialMatch)
306307
{
307308
Datum*queryValues;
308309
int32nQueryValues=0;
@@ -389,6 +390,15 @@ initScanKey(RumScanOpaque so, ScanKey skey, bool *hasNullQuery)
389390
queryValues, (RumNullCategory*)nullFlags,
390391
partial_matches,extra_data,
391392
(skey->sk_flags&SK_ORDER_BY) ? true : false);
393+
394+
if (partial_matches&&hasPartialMatch)
395+
{
396+
int32j;
397+
RumScanKeykey=so->keys[so->nkeys-1];
398+
399+
for (j=0;*hasPartialMatch== false&&j<key->nentries;j++)
400+
*hasPartialMatch |=key->scanEntry[j]->isPartialMatch;
401+
}
392402
}
393403

394404
staticScanDirection
@@ -494,6 +504,7 @@ rumNewScanKey(IndexScanDesc scan)
494504
inti;
495505
boolhasNullQuery= false;
496506
boolcheckEmptyEntry= false;
507+
boolhasPartialMatch= false;
497508
MemoryContextoldCtx;
498509
enum {
499510
haofNone=0x00,
@@ -520,7 +531,7 @@ rumNewScanKey(IndexScanDesc scan)
520531

521532
for (i=0;i<scan->numberOfKeys;i++)
522533
{
523-
initScanKey(so,&scan->keyData[i],&hasNullQuery);
534+
initScanKey(so,&scan->keyData[i],&hasNullQuery,&hasPartialMatch);
524535
if (so->isVoidRes)
525536
break;
526537
}
@@ -542,7 +553,7 @@ rumNewScanKey(IndexScanDesc scan)
542553

543554
for (i=0;i<scan->numberOfOrderBys;i++)
544555
{
545-
initScanKey(so,&scan->orderByData[i],&hasNullQuery);
556+
initScanKey(so,&scan->orderByData[i],&hasNullQuery,NULL);
546557
if (so->isVoidRes)
547558
break;
548559
}
@@ -610,6 +621,8 @@ rumNewScanKey(IndexScanDesc scan)
610621
}
611622

612623
adjustScanDirection(so);
624+
if (scan->numberOfOrderBys>0&&hasPartialMatch)
625+
elog(ERROR,"Partial match and order by index couldn't be used together");
613626

614627
/* initialize expansible array of RumScanEntry pointers */
615628
so->totalentries=0;

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp