Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit b18d5ca

Browse files
author
Alexander Korotkov
committed
Check for unsupported tsqueries.
1 parent 4d6d293 commit b18d5ca

File tree

3 files changed

+12
-0
lines changed

3 files changed

+12
-0
lines changed

expected/ruminv.out

+4
Original file line numberDiff line numberDiff line change
@@ -267,3 +267,7 @@ SELECT * FROM test_invrum WHERE q @@ 'a c d'::tsvector;
267267
( 'a' | 'b' ) & ( 'c' | 'd' )
268268
(5 rows)
269269

270+
INSERT INTO test_invrum VALUES ('a:*'::tsquery);
271+
ERROR: Indexing of prefix tsqueries isn't supported yet
272+
INSERT INTO test_invrum VALUES ('a <-> b'::tsquery);
273+
ERROR: Indexing of phrase tsqueries isn't supported yet

rumtsquery.c

+5
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ make_query_item_wrap(QueryItem *item, QueryItemWrap *parent, bool not)
7373
{
7474
QueryOperand *operand = (QueryOperand *) item;
7575
QueryItemWrap *wrap = add_child(parent);
76+
77+
if (operand->prefix)
78+
elog(ERROR, "Indexing of prefix tsqueries isn't supported yet");
79+
7680
wrap->type = QI_VAL;
7781
wrap->distance = operand->distance;
7882
wrap->length = operand->length;
@@ -111,6 +115,7 @@ make_query_item_wrap(QueryItem *item, QueryItemWrap *parent, bool not)
111115
}
112116
}
113117
case OP_PHRASE:
118+
elog(ERROR, "Indexing of phrase tsqueries isn't supported yet");
114119
default:
115120
elog(ERROR, "Invalid tsquery operator");
116121
}

sql/ruminv.sql

+3
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,6 @@ SELECT * FROM test_invrum WHERE q @@ 'b d'::tsvector;
4343
SELECT * FROM test_invrum WHERE q @@ 'a b d'::tsvector;
4444
SELECT * FROM test_invrum WHERE q @@ 'c d'::tsvector;
4545
SELECT * FROM test_invrum WHERE q @@ 'a c d'::tsvector;
46+
47+
INSERT INTO test_invrum VALUES ('a:*'::tsquery);
48+
INSERT INTO test_invrum VALUES ('a <-> b'::tsquery);

0 commit comments

Comments
 (0)