2
DROP TABLE IF EXISTS t1,t2,t3;
6
a INT AUTO_INCREMENT PRIMARY KEY,
9
) comment = 'original testcase by sroussey@network54.com';
10
INSERT INTO t1 (message) VALUES ("Testing"),("table"),("testbug"),
11
("steve"),("is"),("cool"),("steve is cool");
13
SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve');
14
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve');
15
SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
16
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE);
18
# MATCH + ORDER BY (with ft-ranges)
19
SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY a;
20
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a;
22
# MATCH + ORDER BY (with normal ranges) + UNIQUE
23
SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve') ORDER BY a DESC;
24
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a in (2,7,4) and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY a DESC;
26
# MATCH + ORDER BY + UNIQUE (const_table)
27
SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve') ORDER BY 1;
28
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) FROM t1 WHERE a=7 and MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) ORDER BY 1;
31
SELECT a, FORMAT(MATCH (message) AGAINST ('steve'),6) as rel FROM t1 ORDER BY rel;
32
SELECT a, MATCH (message) AGAINST ('steve' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel;
35
# BUG#6635 - test_if_skip_sort_order() thought it can skip filesort
36
# for fulltext searches too
38
alter table t1 add key m (message);
39
explain SELECT message FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY message;
40
SELECT message FROM t1 WHERE MATCH (message) AGAINST ('steve') ORDER BY message desc;
45
# reused boolean scan bug
48
a INT AUTO_INCREMENT PRIMARY KEY,
52
INSERT INTO t1 (message) VALUES ("testbug"),("testbug foobar");
53
SELECT a, MATCH (message) AGAINST ('t* f*' IN BOOLEAN MODE) as rel FROM t1;
54
SELECT a, MATCH (message) AGAINST ('t* f*' IN BOOLEAN MODE) as rel FROM t1 ORDER BY rel,a;
59
id int(11) NOT NULL auto_increment,
60
thread int(11) NOT NULL default '0',
61
beitrag longtext NOT NULL,
64
FULLTEXT KEY beitrag (beitrag)
65
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=7923 ;
68
id int(11) NOT NULL auto_increment,
69
text varchar(100) NOT NULL default '',
72
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=63 ;
75
id int(11) NOT NULL auto_increment,
76
forum int(11) NOT NULL default '0',
77
betreff varchar(70) NOT NULL default '',
80
FULLTEXT KEY betreff (betreff)
81
) ENGINE=MyISAM DEFAULT CHARSET=utf8 AUTO_INCREMENT=996 ;
84
select a.text, b.id, b.betreff
86
t2 a inner join t3 b on a.id = b.forum inner join
87
t1 c on b.id = c.thread
89
match(b.betreff) against ('+abc' in boolean mode)
90
group by a.text, b.id, b.betreff
92
select a.text, b.id, b.betreff
94
t2 a inner join t3 b on a.id = b.forum inner join
95
t1 c on b.id = c.thread
97
match(c.beitrag) against ('+abc' in boolean mode)
99
a.text, b.id, b.betreff
101
match(b.betreff) against ('+abc' in boolean mode) desc;
104
select a.text, b.id, b.betreff
106
t2 a inner join t3 b on a.id = b.forum inner join
107
t1 c on b.id = c.thread
109
match(b.betreff) against ('+abc' in boolean mode)
111
select a.text, b.id, b.betreff
113
t2 a inner join t3 b on a.id = b.forum inner join
114
t1 c on b.id = c.thread
116
match(c.beitrag) against ('+abc' in boolean mode)
118
match(b.betreff) against ('+abc' in boolean mode) desc;
120
select a.text, b.id, b.betreff
122
t2 a inner join t3 b on a.id = b.forum inner join
123
t1 c on b.id = c.thread
125
match(b.betreff) against ('+abc' in boolean mode)
127
select a.text, b.id, b.betreff
129
t2 a inner join t3 b on a.id = b.forum inner join
130
t1 c on b.id = c.thread
132
match(c.beitrag) against ('+abc' in boolean mode)
134
match(betreff) against ('+abc' in boolean mode) desc;
136
# BUG#11869 part2: used table type doesn't support FULLTEXT indexes error
137
(select b.id, b.betreff from t3 b) union
138
(select b.id, b.betreff from t3 b)
139
order by match(betreff) against ('+abc' in boolean mode) desc;
142
(select b.id, b.betreff from t3 b) union
143
(select b.id, b.betreff from t3 b)
144
order by match(betreff) against ('+abc') desc;
146
select distinct b.id, b.betreff from t3 b
147
order by match(betreff) against ('+abc' in boolean mode) desc;
149
select b.id, b.betreff from t3 b group by b.id+1
150
order by match(betreff) against ('+abc' in boolean mode) desc;