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

Commit37e0f13

Browse files
committed
Fix bug where GIN scan keys were not initialized with gin_fuzzy_search_limit.
When gin_fuzzy_search_limit was used, we could jump out of startScan()without calling startScanKey(). That was harmless in 9.3 and below, becausestartScanKey()() didn't do anything interesting, but in 9.4 it initializesinformation needed for skipping entries (aka GIN fast scans), and youreadily get a segfault if it's not done. Nevertheless, it was clearly wrongall along, so backpatch all the way to 9.1 where the early return wasintroduced.(AFAICS startScanKey() did nothing useful in 9.3 and below, because thefields it initialized were already initialized in ginFillScanKey(), but Idon't dare to change that in a minor release. ginFillScanKey() is alwayscalled in gingetbitmap() even though there's a check there to see if thescan keys have already been initialized, because they never are; ginrescan()free's them.)In the passing, remove unnecessary if-check from the second inner loop instartScan(). We already check in the first loop that the condition is truefor all entries.Reported by Olaf Gawenda, bug #12694, Backpatch to 9.1 and above, althoughAFAICS it causes a live bug only in 9.4.
1 parent88b45aa commit37e0f13

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

‎src/backend/access/gin/ginget.c

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -511,17 +511,24 @@ startScan(IndexScanDesc scan)
511511
* supposition isn't true), that total result will not more than
512512
* minimal predictNumberResult.
513513
*/
514+
boolreduce= true;
514515

515516
for (i=0;i<so->totalentries;i++)
517+
{
516518
if (so->entries[i]->predictNumberResult <=so->totalentries*GinFuzzySearchLimit)
517-
return;
518-
519-
for (i=0;i<so->totalentries;i++)
520-
if (so->entries[i]->predictNumberResult>so->totalentries*GinFuzzySearchLimit)
519+
{
520+
reduce= false;
521+
break;
522+
}
523+
}
524+
if (reduce)
525+
{
526+
for (i=0;i<so->totalentries;i++)
521527
{
522528
so->entries[i]->predictNumberResult /=so->totalentries;
523529
so->entries[i]->reduceResult= TRUE;
524530
}
531+
}
525532
}
526533

527534
for (i=0;i<so->nkeys;i++)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp