1 # Regressiontest for statements that failed with optimizer tracing enabled.
3 --source include/have_optimizer_trace.inc
4 # InnoDB page size influences cost numbers
5 --source include/have_innodb_16k.inc
7 let $DEFAULT_TRACE_MEM_SIZE=1048576; # 1MB
8 eval
set optimizer_trace_max_mem_size=$DEFAULT_TRACE_MEM_SIZE;
10 SET end_markers_in_json=on;
11 SET optimizer_trace=
"enabled=on,one_line=off";
14 --echo # BUG#12430646 - SEL_ARG::LEFT AND RIGHT POINTERS INCORRECTLY
15 --echo # USED. CRASHES OPTIMIZER TRACING
28 INSERT INTO t1 VALUES (NULL,
'a', 1, 2), (NULL,
'a', 1, 2),
29 (1,
'a', 1, 2), (1,
'a', 1, 2);
38 INSERT INTO t2 VALUES (1, 1, NULL), (1, 1, NULL);
42 WHERE t1.d <>
'1' AND t1.b >
'1'
43 AND t1.a = t2.a AND t1.c = t2.c;
48 --echo # BUG#12595210 - JSON SYNTAX ERROR ASSERT ON WHERE FIELD NOT IN SUBQUERY
51 # This trace exhibits a non-empty
52 # "evaluating_constant_where_conditions" object which is rare.
55 pk INT NOT NULL AUTO_INCREMENT,
56 col_int_key INT DEFAULT NULL,
57 col_varchar_key VARCHAR(1) DEFAULT NULL,
62 pk INT NOT NULL AUTO_INCREMENT,
63 col_int_key INT DEFAULT NULL,
64 col_varchar_key VARCHAR(1) DEFAULT NULL,
65 col_varchar_nokey VARCHAR(1) DEFAULT NULL,
70 pk INT NOT NULL AUTO_INCREMENT,
71 col_int_key INT DEFAULT NULL,
72 col_varchar_key VARCHAR(1) DEFAULT NULL,
73 col_varchar_nokey VARCHAR(1) DEFAULT NULL,
78 pk INT NOT NULL AUTO_INCREMENT,
79 col_int_key INT DEFAULT NULL,
80 col_varchar_key VARCHAR(1) DEFAULT NULL,
84 CREATE VIEW view_t4 AS SELECT * FROM t4;
89 SELECT SUM(sq1_alias1.pk) AS sq1_field1
90 FROM view_t4 AS sq1_alias1
91 INNER
JOIN t1 AS sq1_alias2 ON (sq1_alias2.col_varchar_key =
92 sq1_alias1.col_varchar_key )
94 alias1.col_varchar_nokey AS field2
96 LEFT
JOIN ( t2 AS alias2
97 LEFT OUTER
JOIN t2 AS alias3 ON (alias3.col_varchar_nokey =
98 alias2.col_varchar_key )
99 ) ON (alias3.col_varchar_key = alias2.col_varchar_key)
101 WHERE ( alias2.col_varchar_key IN (
102 SELECT sq2_alias1.col_varchar_nokey AS sq2_field1
103 FROM t3 AS sq2_alias1
104 WHERE sq2_alias1.col_varchar_nokey <= alias1.col_varchar_key
108 eval CREATE
TABLE where_subselect_19379 $query;
109 --disable_ps_protocol
# because of BUG#12595688
110 eval SELECT * FROM where_subselect_19379 WHERE (field1, field2) NOT IN
114 select * from information_schema.OPTIMIZER_TRACE;
116 drop
table t1,t2,t3,t4,where_subselect_19379;
120 --echo # BUG#12607524 JSON PARSE ERROR ON SELECT ... FROM ... WHERE .. IN (SUBQUERY)
124 col_int_key
int(11) DEFAULT NULL,
125 col_varchar_key varchar(1) DEFAULT NULL,
126 KEY col_int_key (col_int_key),
127 KEY col_varchar_key (col_varchar_key,col_int_key)
129 INSERT INTO t1 VALUES (8,'g');
132 col_int_key
int(11) DEFAULT NULL,
133 col_varchar_key varchar(1) DEFAULT NULL,
134 KEY col_int_key (col_int_key),
135 KEY col_varchar_key (col_varchar_key,col_int_key)
137 INSERT INTO t2 VALUES (7,'x');
139 CREATE
TABLE where_subselect_19033
141 ( SELECT col_int_key FROM t2 ) as field1
145 SELECT * FROM where_subselect_19033;
148 FROM where_subselect_19033
151 ( SELECT col_int_key FROM t2 )
156 SELECT * FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;
158 DROP
TABLE where_subselect_19033,t1,t2;
161 --echo
# BUG#12612201 - SEGFAULT IN
162 --echo # SUBSELECT_UNIQUESUBQUERY_ENGINE::PRINT WITH OPTIMIZER TRACE
166 col_int_key
int(11) DEFAULT NULL,
167 col_varchar_key varchar(1) DEFAULT NULL,
168 col_varchar_nokey varchar(1) DEFAULT NULL
172 pk
int(11) NOT NULL AUTO_INCREMENT,
173 col_int_key
int(11) DEFAULT NULL,
174 col_varchar_key varchar(1) DEFAULT NULL,
175 col_varchar_nokey varchar(1) DEFAULT NULL,
179 INSERT INTO t2 VALUES (1,4,
'v',
'v'),(20,5,
'r',
'r');
182 col_int_key
int(11) DEFAULT NULL,
183 col_varchar_key varchar(1) DEFAULT NULL,
184 col_varchar_nokey varchar(1) DEFAULT NULL
187 INSERT INTO t3 VALUES (NULL,
'j',
'j'),(8,
'c',
'c');
190 select count( alias2 . col_varchar_key ) as field1
192 (select sq1_alias1 . *
193 from ( t3 as sq1_alias1
194 straight_join t1 as sq1_alias2
195 on (sq1_alias2 . col_varchar_key = sq1_alias1 . col_varchar_key)
197 where sq1_alias1 . col_int_key in (
198 select c_sq1_alias1 . pk as c_sq1_field1
199 from t2 as c_sq1_alias1
202 left outer join t1 as alias2
203 on (alias2 . col_varchar_key = alias1 . col_varchar_key )
205 where ( alias2 . col_varchar_key in (
206 select sq2_alias1 . col_varchar_nokey as sq2_field1
207 from t2 as sq2_alias1
208 where sq2_alias1 . col_int_key in (
209 select distinct c_sq2_alias1 . col_int_key as c_sq2_field1
210 from t3 as c_sq2_alias1
213 or alias1 . col_int_key = 2
214 and alias2 . col_varchar_nokey <= alias1 . col_varchar_nokey
215 order by alias1 . col_varchar_key , field1
218 eval CREATE
TABLE where_updatedelete_20769 $query;
220 eval UPDATE where_updatedelete_20769 SET field1 = ( $query );
222 DROP
TABLE where_updatedelete_20769;
226 --echo # BUG#12710761 - INVALID JSON TRACE ON SUBQUERY IN IN-CLAUSE
229 CREATE
TABLE t1 (col_int_key
int,
KEY col_int_key (col_int_key));
230 INSERT INTO t1 VALUES (0),(8),(1),(8);
232 CREATE
TABLE where_subselect_20070
233 SELECT table2 .col_int_key AS field1,
234 ( SELECT COUNT( col_int_key )
239 ON table2 .col_int_key = table1 .col_int_key;
242 FROM where_subselect_20070
243 WHERE (field1, ( SELECT COUNT( col_int_key ) FROM t1 )) IN (
244 SELECT table2 .col_int_key AS field1,
245 ( SELECT COUNT( col_int_key )
250 ON table2 .col_int_key = table1 .col_int_key
253 select * from information_schema.optimizer_trace;
255 DROP
TABLE where_subselect_20070,t1;
258 --echo # Bug#13430443 - ASSERTION `NEW_TYPE[0] !=
'U'' FAILED. WHEN
259 --echo # OPTIMIZER_TRACE IS ENABLED
262 (a INT,b INT,c INT, KEY(a),KEY (a,c)) ENGINE=INNODB;
263 SELECT 1 FROM t1 WHERE 1 LIKE
264 (SELECT a FROM t1 WHERE a = 1 ORDER BY c);
265 SELECT * FROM INFORMATION_SCHEMA.OPTIMIZER_TRACE;