@@ -23,10 +23,10 @@ sub test_index_replay
23
23
my $queries = qq( SET enable_seqscan=off;
24
24
SET enable_bitmapscan=on;
25
25
SET enable_indexscan=on;
26
- SELECT * FROM tst WHERE t \@ @ to_tsquery('simple', 'b ');
27
- SELECT * FROM tst WHERE t \@ @ to_tsquery('simple', 'f ');
28
- SELECT * FROM tst WHERE i = 3 AND t \@ @ to_tsquery('simple', 'c ');
29
- SELECT * FROM tst WHERE i = 7 AND t \@ @ to_tsquery('simple', 'e ');
26
+ SELECT * FROM tst WHERE t \@ @ to_tsquery('simple', 'qscfq ');
27
+ SELECT * FROM tst WHERE t \@ @ to_tsquery('simple', 'ztcow ');
28
+ SELECT * FROM tst WHERE t \@ @ to_tsquery('simple', 'jqljy ');
29
+ SELECT * FROM tst WHERE t \@ @ to_tsquery('simple', 'lvnex ');
30
30
) ;
31
31
32
32
# Run test queries and compare their result
@@ -54,7 +54,11 @@ sub test_index_replay
54
54
# Create some rum index on master
55
55
$node_master -> psql(" postgres" , " CREATE EXTENSION rum;" );
56
56
$node_master -> psql(" postgres" , " CREATE TABLE tst (i int4, t tsvector);" );
57
- $node_master -> psql(" postgres" , " INSERT INTO tst SELECT i%10, to_tsvector('simple', substr(md5(i::text), 1, 1)) FROM generate_series(1,100000) i;" );
57
+ $node_master -> psql(" postgres" , " INSERT INTO tst SELECT i%10,
58
+ to_tsvector('simple', array_to_string(array(
59
+ select substr('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', trunc(random() * 52)::integer + 1, 1)
60
+ FROM generate_series(i, i + 4)), ''))
61
+ FROM generate_series(1,100000) i;" );
58
62
$node_master -> psql(" postgres" , " CREATE INDEX rumidx ON tst USING rum (t rum_tsvector_ops);" );
59
63
60
64
# Test that queries give same result
@@ -68,6 +72,10 @@ sub test_index_replay
68
72
$node_master -> psql(" postgres" , " VACUUM tst;" );
69
73
test_index_replay(" vacuum $i " );
70
74
my ($start , $end ) = (100001 + ($i - 1) * 10000, 100000 + $i * 10000);
71
- $node_master -> psql(" postgres" , " INSERT INTO tst SELECT i%10, to_tsvector('simple', substr(md5(i::text), 1, 1)) FROM generate_series($start ,$end ) i;" );
75
+ $node_master -> psql(" postgres" , " INSERT INTO tst SELECT i%10,
76
+ to_tsvector('simple', array_to_string(array(
77
+ select substr('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', trunc(random() * 52)::integer + 1, 1)
78
+ FROM generate_series(i, i + 4)), ''))
79
+ FROM generate_series($start ,$end ) i;" );
72
80
test_index_replay(" insert $i " );
73
81
}
0 commit comments