File tree Expand file tree Collapse file tree 2 files changed +80
-0
lines changed
Expand file tree Collapse file tree 2 files changed +80
-0
lines changed Original file line number Diff line number Diff line change 1+ CREATE SCHEMA test;
2+ CREATE EXTENSION tsvector2 SCHEMA test;
3+ ERROR: extension "tsvector2" must be installed in schema "public"
4+ CREATE EXTENSION tsvector2;
5+ CREATE TABLE test.t1(a tsvector2);
6+ CREATE OR REPLACE FUNCTION test.insert_records()
7+ RETURNS VOID AS $$
8+ DECLARE
9+ x int;
10+ BEGIN
11+ FOR x IN
12+ SELECT i FROM generate_series(1, 1000) i
13+ LOOP
14+ INSERT INTO test.t1(a)
15+ SELECT array_to_tsvector2(array_agg(repeat(letter, floor(random() * count + 1)::int)))
16+ FROM (
17+ SELECT chr(i) AS letter, b AS count
18+ FROM generate_series(ascii('a'), ascii('z')) i
19+ FULL OUTER JOIN
20+ (SELECT b FROM generate_series(3, 12) b) t2
21+ ON true
22+ ) t3;
23+ END LOOP;
24+ END
25+ $$ LANGUAGE plpgsql;
26+ SELECT test.insert_records();
27+ insert_records
28+ ----------------
29+
30+ (1 row)
31+
32+ CREATE INDEX i1 ON test.t1 USING btree(a);
33+ SET enable_seqscan = off;
34+ EXPLAIN (COSTS OFF) SELECT * FROM test.t1 WHERE a >= 'a:1 b:2'::tsvector2;
35+ QUERY PLAN
36+ ---------------------------------------------------------
37+ Bitmap Heap Scan on t1
38+ Recheck Cond: (a >= '''a'':1 ''b'':2'::tsvector2)
39+ -> Bitmap Index Scan on i1
40+ Index Cond: (a >= '''a'':1 ''b'':2'::tsvector2)
41+ (4 rows)
42+
43+ DROP SCHEMA test CASCADE;
44+ NOTICE: drop cascades to 2 other objects
45+ DETAIL: drop cascades to table test.t1
46+ drop cascades to function test.insert_records()
47+ DROP EXTENSION tsvector2 CASCADE;
Original file line number Diff line number Diff line change 1+ CREATE SCHEMA test ;
2+ CREATE EXTENSION tsvector2 SCHEMA test;
3+ CREATE EXTENSION tsvector2;
4+ CREATE TABLE test .t1(a tsvector2);
5+
6+ CREATE OR REPLACE FUNCTION test .insert_records()
7+ RETURNS VOID AS $$
8+ DECLARE
9+ x int ;
10+ BEGIN
11+ FOR x IN
12+ SELECT i FROM generate_series(1 , 1000 ) i
13+ LOOP
14+ INSERT INTO test .t1 (a)
15+ SELECT array_to_tsvector2(array_agg(repeat(letter, floor(random() * count + 1 )::int )))
16+ FROM (
17+ SELECT chr(i) AS letter, b AS count
18+ FROM generate_series(ascii(' a' ), ascii(' z' )) i
19+ FULL OUTER JOIN
20+ (SELECT b FROM generate_series(3 , 12 ) b) t2
21+ ON true
22+ ) t3;
23+ END LOOP;
24+ END
25+ $$ LANGUAGE plpgsql;
26+
27+ SELECT test .insert_records ();
28+ CREATE INDEX i1 ON test .t1 USING btree(a);
29+
30+ SET enable_seqscan = off;
31+ EXPLAIN (COSTS OFF) SELECT * FROM test .t1 WHERE a >= ' a:1 b:2' ::tsvector2;
32+ DROP SCHEMA test CASCADE;
33+ DROP EXTENSION tsvector2 CASCADE;
You can’t perform that action at this time.
0 commit comments