Skip to content

Commit 8427ad0

Browse files
author
Artur Zakirov
committed
Fix inconsistency result with index scan using negation query.
For example, the following queries have returned wrong results: SELECT t FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english', '!gave & way'); SELECT t FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english', '!gave & wooded & !look'); But the following query have returned right result: SELECT t FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english', 'gave & !way'); Now all queries return right results.
1 parent 0700d5d commit 8427ad0

File tree

3 files changed

+23
-1
lines changed

3 files changed

+23
-1
lines changed

expected/rum.out

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,24 @@ SELECT count(*) FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english', '(gave
8282
2
8383
(1 row)
8484

85+
SELECT count(*) FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english', '(gave | !half) <-> way');
86+
count
87+
-------
88+
3
89+
(1 row)
90+
91+
SELECT count(*) FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english', '!gave & way');
92+
count
93+
-------
94+
3
95+
(1 row)
96+
97+
SELECT count(*) FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english', '!gave & wooded & !look');
98+
count
99+
-------
100+
1
101+
(1 row)
102+
85103
SELECT count(*) FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english',
86104
'def <-> fgr');
87105
count

rumget.c

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2020,7 +2020,8 @@ scanGetItemFast(IndexScanDesc scan, RumKey *advancePast,
20202020
if (!callConsistentFn(&so->rumstate, key))
20212021
{
20222022
consistentResult = false;
2023-
entryShift(k, so, false);
2023+
for (j = k; j < so->totalentries; j++)
2024+
entryShift(j, so, false);
20242025
continue;
20252026
}
20262027
}

sql/rum.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ SELECT count(*) FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english', 'among
2828
SELECT count(*) FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english', 'structure&ancient');
2929
SELECT count(*) FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english', '(complimentary|sight)&(sending|heart)');
3030
SELECT count(*) FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english', '(gave | half) <-> way');
31+
SELECT count(*) FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english', '(gave | !half) <-> way');
32+
SELECT count(*) FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english', '!gave & way');
33+
SELECT count(*) FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english', '!gave & wooded & !look');
3134
SELECT count(*) FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english',
3235
'def <-> fgr');
3336
SELECT count(*) FROM test_rum WHERE a @@ to_tsquery('pg_catalog.english',

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