Skip to content

Commit 3b26d4d

Browse files
author
Marina Polyakova
committed
Merge remote-tracking branch 'origin/PGPRO-8894'
2 parents 8e8026c + 61258f4 commit 3b26d4d

File tree

6 files changed

+60
-6
lines changed

6 files changed

+60
-6
lines changed

.travis.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,8 @@ notifications:
2323
on_failure: always
2424

2525
env:
26+
- PG_VERSION=16
27+
- PG_VERSION=16 LEVEL=hardcore
2628
- PG_VERSION=15
2729
- PG_VERSION=15 LEVEL=hardcore
2830
- PG_VERSION=14
@@ -33,5 +35,3 @@ env:
3335
- PG_VERSION=12 LEVEL=hardcore
3436
- PG_VERSION=11
3537
- PG_VERSION=11 LEVEL=hardcore
36-
- PG_VERSION=10
37-
- PG_VERSION=10 LEVEL=hardcore

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ REGRESS = security rum rum_validate rum_hash ruminv timestamp orderby orderby_ha
3030
int2 int4 int8 float4 float8 money oid \
3131
time timetz date interval \
3232
macaddr inet cidr text varchar char bytea bit varbit \
33-
numeric rum_weight
33+
numeric rum_weight expr
3434

3535
TAP_TESTS = 1
3636

expected/expr.out

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
CREATE TABLE documents (
2+
en text not null,
3+
score float not null,
4+
textsearch_index_en_col tsvector
5+
);
6+
INSERT INTO documents VALUES ('the pet cat is in the shed', 56, to_tsvector('english', 'the pet cat is in the shed'));
7+
CREATE INDEX textsearch_index_en ON documents
8+
USING rum (textsearch_index_en_col rum_tsvector_addon_ops, score)
9+
WITH (attach = 'score', to = 'textsearch_index_en_col');
10+
SET enable_seqscan=off;
11+
-- should be 1 row
12+
SELECT * FROM documents WHERE textsearch_index_en_col @@ ('pet'::tsquery <-> ('dog'::tsquery || 'cat'::tsquery));
13+
en | score | textsearch_index_en_col
14+
----------------------------+-------+--------------------------
15+
the pet cat is in the shed | 56 | 'cat':3 'pet':2 'shed':7
16+
(1 row)
17+
18+
SET enable_seqscan=on;
19+
-- 1 row
20+
SELECT * FROM documents WHERE textsearch_index_en_col @@ ('pet'::tsquery <-> ('dog'::tsquery || 'cat'::tsquery));
21+
en | score | textsearch_index_en_col
22+
----------------------------+-------+--------------------------
23+
the pet cat is in the shed | 56 | 'cat':3 'pet':2 'shed':7
24+
(1 row)
25+
26+
DROP TABLE documents;

sql/expr.sql

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
CREATE TABLE documents (
2+
en text not null,
3+
score float not null,
4+
textsearch_index_en_col tsvector
5+
);
6+
7+
INSERT INTO documents VALUES ('the pet cat is in the shed', 56, to_tsvector('english', 'the pet cat is in the shed'));
8+
9+
CREATE INDEX textsearch_index_en ON documents
10+
USING rum (textsearch_index_en_col rum_tsvector_addon_ops, score)
11+
WITH (attach = 'score', to = 'textsearch_index_en_col');
12+
13+
SET enable_seqscan=off;
14+
-- should be 1 row
15+
SELECT * FROM documents WHERE textsearch_index_en_col @@ ('pet'::tsquery <-> ('dog'::tsquery || 'cat'::tsquery));
16+
17+
SET enable_seqscan=on;
18+
-- 1 row
19+
SELECT * FROM documents WHERE textsearch_index_en_col @@ ('pet'::tsquery <-> ('dog'::tsquery || 'cat'::tsquery));
20+
21+
DROP TABLE documents;

src/rum_ts_utils.c

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -284,7 +284,14 @@ checkcondition_rum(void *checkval, QueryOperand *val, ExecPhraseData *data)
284284
* addInfo
285285
*/
286286
if (gcv->recheckPhrase)
287-
return ((val->weight) ? TS_MAYBE : TS_YES);
287+
{
288+
/*
289+
* We cannot return TS_YES here (if "val->weight > 0"), because
290+
* data->npos = 0 and we have incorrect porocessing of this result
291+
* at the upper levels. So return TS_MAYBE.
292+
*/
293+
return TS_MAYBE;
294+
}
288295

289296
positions = DatumGetByteaP(gcv->addInfo[j]);
290297
ptrt = (char *) VARDATA_ANY(positions);

travis/Dockerfile.in

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,10 @@ FROM postgres:${PG_VERSION}-alpine
44
RUN apk add --no-cache \
55
linux-headers \
66
openssl curl \
7-
perl perl-ipc-run \
7+
perl perl-ipc-run perl-dev perl-app-cpanminus perl-dbi \
88
make musl-dev gcc bison flex coreutils \
99
zlib-dev libedit-dev \
10-
clang clang-analyzer;
10+
pkgconf icu-dev clang clang15 clang-analyzer;
1111

1212
# Environment
1313
ENV LANG=C.UTF-8 PGDATA=/pg/data

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