Debian Codegraph @

mysql-test/suite/query_rewrite_plugins/r/optional_columns.result

raw
1 #
2 # Tests that the optional column columns work both of they are present
3 # and absent. PATTERN_DIGEST and NORMALIZED_PATTERN are optional write-
4 # only columns that are not present by default. The MESSAGE column is
5 # optional, but included in the install script by default.
6 #
7 # Query rewrite plugin was installed.
8 #
9 # Testing with PATTERN_DIGEST and NORMALIZED_PATTERN columns.
10 #
11 CREATE TABLE t1 ( a VARCHAR(10), b VARCHAR(10) );
12 INSERT INTO t1 VALUES ( 'abc', 'def' ), ( 'ghi', 'klm' ), ( 'nop', 'qrs' );
13 CREATE TABLE t2 ( a VARCHAR(10) );
14 INSERT INTO t2 VALUES ( 'abc' ), ( 'klm' );
15 # Test of literals matching.
16 INSERT INTO query_rewrite.rewrite_rules ( pattern, replacement )
17 VALUES ( 'SELECT ?', 'SELECT "literal"' );
18 SELECT * FROM query_rewrite.rewrite_rules;
19 id pattern pattern_database replacement enabled message pattern_digest normalized_pattern
20 1 SELECT ? NULL SELECT "literal" YES NULL NULL NULL
21 CALL query_rewrite.flush_rewrite_rules();
22 SELECT * FROM query_rewrite.rewrite_rules;
23 id pattern pattern_database replacement enabled message pattern_digest normalized_pattern
24 1 SELECT ? NULL SELECT "literal" YES NULL d1b44b0c19af710b5a679907e284acd2ddc285201794bc69a2389d77baedddae select ?
25 SELECT NULL;
26 literal
27 literal
28 Warnings:
29 Note 1105 Query 'SELECT NULL' rewritten to 'SELECT "literal"' by a query rewrite plugin
30 SELECT 'abc';
31 literal
32 literal
33 Warnings:
34 Note 1105 Query 'SELECT 'abc'' rewritten to 'SELECT "literal"' by a query rewrite plugin
35 SELECT 1;
36 literal
37 literal
38 Warnings:
39 Note 1105 Query 'SELECT 1' rewritten to 'SELECT "literal"' by a query rewrite plugin
40 SELECT 1.1;
41 literal
42 literal
43 Warnings:
44 Note 1105 Query 'SELECT 1.1' rewritten to 'SELECT "literal"' by a query rewrite plugin
45 SELECT 123456789123456789123456789123456789123456789123456789;
46 literal
47 literal
48 Warnings:
49 Note 1105 Query 'SELECT 123456789123456789123456789123456789123456789123456789' rewritten to 'SELECT "literal"' by a query rewrite plugin
50 # Check our status variables.
51 SHOW STATUS LIKE 'Rewriter%';
52 Variable_name Value
53 Rewriter_number_loaded_rules 1
54 Rewriter_number_reloads 2
55 Rewriter_number_rewritten_queries 5
56 Rewriter_reload_error OFF
57 DELETE FROM query_rewrite.rewrite_rules;
58 INSERT INTO query_rewrite.rewrite_rules ( pattern, replacement )
59 VALUES ( 'SELECT * FROM test.t1 WHERE ( a = ? AND TRUE ) OR b = ?',
60 'SELECT a FROM test.t1 WHERE a = ?' ),
61 ( 'SELECT a FROM test.t1',
62 'SELECT * FROM test.t1 WHERE a = \'abc\'' ),
63 ( 'SELECT a FROM test.t1 WHERE b = ?',
64 'SELECT * FROM test.t1 WHERE b = ?' ),
65 ( 'SELECT * FROM test.t2',
66 'SELECT * FROM test.t1 JOIN test.t2 ON t1.a = t2.a' ),
67 ( 'SELECT * FROM test.t1 WHERE a = ? OR b = ?',
68 'SELECT * FROM test.t1 WHERE b = ? OR a = ?' );
69 SELECT * FROM query_rewrite.rewrite_rules;
70 id pattern pattern_database replacement enabled message pattern_digest normalized_pattern
71 2 SELECT * FROM test.t1 WHERE ( a = ? AND TRUE ) OR b = ? NULL SELECT a FROM test.t1 WHERE a = ? YES NULL NULL NULL
72 3 SELECT a FROM test.t1 NULL SELECT * FROM test.t1 WHERE a = 'abc' YES NULL NULL NULL
73 4 SELECT a FROM test.t1 WHERE b = ? NULL SELECT * FROM test.t1 WHERE b = ? YES NULL NULL NULL
74 5 SELECT * FROM test.t2 NULL SELECT * FROM test.t1 JOIN test.t2 ON t1.a = t2.a YES NULL NULL NULL
75 6 SELECT * FROM test.t1 WHERE a = ? OR b = ? NULL SELECT * FROM test.t1 WHERE b = ? OR a = ? YES NULL NULL NULL
76 CALL query_rewrite.flush_rewrite_rules();
77 SELECT * FROM query_rewrite.rewrite_rules;
78 id pattern pattern_database replacement enabled message pattern_digest normalized_pattern
79 2 SELECT * FROM test.t1 WHERE ( a = ? AND TRUE ) OR b = ? NULL SELECT a FROM test.t1 WHERE a = ? YES NULL 013244d601fea8fdb057f1a6fcf1222b6fe0214597fe5ef4aaf96aeabe09069f select `*` from `test`.`t1` where (((`a` = ?) and true) or (`b` = ?))
80 3 SELECT a FROM test.t1 NULL SELECT * FROM test.t1 WHERE a = 'abc' YES NULL 28939802f16d07e5b5ba42bded44d5bab1108022d2541e345a29040a323b01c8 select `a` from `test`.`t1`
81 4 SELECT a FROM test.t1 WHERE b = ? NULL SELECT * FROM test.t1 WHERE b = ? YES NULL 07f316122bd78ef48f419a40d301b7ade32dda8162ba40a11711ca428d16a02b select `a` from `test`.`t1` where (`b` = ?)
82 5 SELECT * FROM test.t2 NULL SELECT * FROM test.t1 JOIN test.t2 ON t1.a = t2.a YES NULL 666794284a40552eef7ab3173f130f1eec095c1fd1d5412c2d63dbc3a9f3a0b1 select `*` from `test`.`t2`
83 6 SELECT * FROM test.t1 WHERE a = ? OR b = ? NULL SELECT * FROM test.t1 WHERE b = ? OR a = ? YES NULL 9e2f0e4b7156eda97bdab476e09da81907bde37c25ebd8e1ada5b4a1b39db71e select `*` from `test`.`t1` where ((`a` = ?) or (`b` = ?))
84 # Check a query that doesn't have a rewrite rule doesn't get rewritten.
85 SELECT b FROM test.t1;
86 b
87 def
88 klm
89 qrs
90 # Check a query with just one parameter.
91 SELECT a FROM test.t1 WHERE b = 'qrs';
92 a b
93 nop qrs
94 Warnings:
95 Note 1105 Query 'SELECT a FROM test.t1 WHERE b = 'qrs'' rewritten to 'SELECT * FROM test.t1 WHERE b = 'qrs'' by a query rewrite plugin
96 # Check a rule with parameter truncation (fewer parameters in the
97 # output query than in the input query);
98 SELECT * FROM test.t1 WHERE ( a = 'abc' AND TRUE ) OR b = 'klm';
99 a
100 abc
101 Warnings:
102 Note 1105 Query 'SELECT * FROM test.t1 WHERE ( a = 'abc' AND TRUE ) OR b = 'klm'' rewritten to 'SELECT a FROM test.t1 WHERE a = 'abc'' by a query rewrite plugin
103 SELECT * FROM test.t1 WHERE ( a = 'abc' AND FALSE ) OR b = 'klm';
104 a b
105 ghi klm
106 # Check a non parameterized query.
107 SELECT * from t1 WHERE a = 'abc';
108 a b
109 abc def
110 # Check that a non-rewritten query does not yield a warning.
111 SELECT b FROM test.t1;
112 b
113 def
114 klm
115 qrs
116 # Check that a query is not rewritten if the query corresponds to a
117 # replacement.
118 SELECT a FROM test.t1;
119 a b
120 abc def
121 Warnings:
122 Note 1105 Query 'SELECT a FROM test.t1' rewritten to 'SELECT * FROM test.t1 WHERE a = 'abc'' by a query rewrite plugin
123 # Check that we can execute a rewrite more than once.
124 SELECT * FROM test.t2;
125 a b a
126 abc def abc
127 Warnings:
128 Note 1105 Query 'SELECT * FROM test.t2' rewritten to 'SELECT * FROM test.t1 JOIN test.t2 ON t1.a = t2.a' by a query rewrite plugin
129 SELECT * FROM test.t2;
130 a b a
131 abc def abc
132 Warnings:
133 Note 1105 Query 'SELECT * FROM test.t2' rewritten to 'SELECT * FROM test.t1 JOIN test.t2 ON t1.a = t2.a' by a query rewrite plugin
134 # Remove the warnings.
135 SELECT b FROM test.t1;
136 b
137 def
138 klm
139 qrs
140 # Check parameter switching in a query rewrite
141 SELECT * FROM test.t1 WHERE a = 'def' OR b = 'ghi';
142 a b
143 abc def
144 ghi klm
145 Warnings:
146 Note 1105 Query 'SELECT * FROM test.t1 WHERE a = 'def' OR b = 'ghi'' rewritten to 'SELECT * FROM test.t1 WHERE b = 'def' OR a = 'ghi'' by a query rewrite plugin
147 # Verify with whitespace.
148 SELECT * FROM test.t1 WHERE a = 'def' OR b = 'ghi';
149 a b
150 abc def
151 ghi klm
152 Warnings:
153 Note 1105 Query 'SELECT * FROM test.t1 WHERE a = 'def' OR b = 'ghi'' rewritten to 'SELECT * FROM test.t1 WHERE b = 'def' OR a = 'ghi'' by a query rewrite plugin
154 # Verify with comments.
155 SELECT * FROM test.t1 WHERE a =/* 'def' ? */'def' OR b = 'ghi';
156 a b
157 abc def
158 ghi klm
159 Warnings:
160 Note 1105 Query 'SELECT * FROM test.t1 WHERE a =/* 'def' ? */'def' OR b = 'ghi'' rewritten to 'SELECT * FROM test.t1 WHERE b = 'def' OR a = 'ghi'' by a query rewrite plugin
161 # Check our status variables.
162 SHOW STATUS LIKE 'Rewriter%';
163 Variable_name Value
164 Rewriter_number_loaded_rules 5
165 Rewriter_number_reloads 3
166 Rewriter_number_rewritten_queries 13
167 Rewriter_reload_error OFF
168 DROP TABLE t1;
169 DROP TABLE t2;
170 DELETE FROM query_rewrite.rewrite_rules;
171 # Test of literals matching.
172 INSERT INTO query_rewrite.rewrite_rules ( pattern, replacement )
173 VALUES ( 'SELECT 1, ?', 'SELECT "rewritten w/rule 1"' ),
174 ( 'SELECT 2, ?', 'SELECT "rewritten w/rule 2"' ),
175 ( 'SELECT "The_original_query"', 'SELECT "The_rewritten_query"');
176 SELECT * FROM query_rewrite.rewrite_rules;
177 id pattern pattern_database replacement enabled message pattern_digest normalized_pattern
178 7 SELECT 1, ? NULL SELECT "rewritten w/rule 1" YES NULL NULL NULL
179 8 SELECT 2, ? NULL SELECT "rewritten w/rule 2" YES NULL NULL NULL
180 9 SELECT "The_original_query" NULL SELECT "The_rewritten_query" YES NULL NULL NULL
181 CALL query_rewrite.flush_rewrite_rules();
182 SELECT * FROM query_rewrite.rewrite_rules;
183 id pattern pattern_database replacement enabled message pattern_digest normalized_pattern
184 7 SELECT 1, ? NULL SELECT "rewritten w/rule 1" YES NULL efb26d6aca0766da4a6d37f3e3aa5332542ff42893ff98fbb393da4e8cbd6a10 select ?,?
185 8 SELECT 2, ? NULL SELECT "rewritten w/rule 2" YES NULL efb26d6aca0766da4a6d37f3e3aa5332542ff42893ff98fbb393da4e8cbd6a10 select ?,?
186 9 SELECT "The_original_query" NULL SELECT "The_rewritten_query" YES NULL d1b44b0c19af710b5a679907e284acd2ddc285201794bc69a2389d77baedddae select ?
187 SELECT 1, 1;
188 rewritten w/rule 1
189 rewritten w/rule 1
190 Warnings:
191 Note 1105 Query 'SELECT 1, 1' rewritten to 'SELECT "rewritten w/rule 1"' by a query rewrite plugin
192 SELECT 1, 2;
193 rewritten w/rule 1
194 rewritten w/rule 1
195 Warnings:
196 Note 1105 Query 'SELECT 1, 2' rewritten to 'SELECT "rewritten w/rule 1"' by a query rewrite plugin
197 SELECT 2, 1;
198 rewritten w/rule 2
199 rewritten w/rule 2
200 Warnings:
201 Note 1105 Query 'SELECT 2, 1' rewritten to 'SELECT "rewritten w/rule 2"' by a query rewrite plugin
202 SELECT 2, 2;
203 rewritten w/rule 2
204 rewritten w/rule 2
205 Warnings:
206 Note 1105 Query 'SELECT 2, 2' rewritten to 'SELECT "rewritten w/rule 2"' by a query rewrite plugin
207 SELECT 3, 1;
208 3 1
209 3 1
210 SELECT 3, 2;
211 3 2
212 3 2
213 SELECT 'The_original_query';
214 The_rewritten_query
215 The_rewritten_query
216 Warnings:
217 Note 1105 Query 'SELECT 'The_original_query'' rewritten to 'SELECT "The_rewritten_query"' by a query rewrite plugin
218 DELETE FROM query_rewrite.rewrite_rules;
219 DELETE FROM query_rewrite.rewrite_rules;
220 #
221 # Testing with a NORMALIZED_PATTERN column.
222 #
223 ALTER TABLE query_rewrite.rewrite_rules DROP COLUMN pattern_digest;
224 CREATE TABLE t1 ( a VARCHAR(10), b VARCHAR(10) );
225 INSERT INTO t1 VALUES ( 'abc', 'def' ), ( 'ghi', 'klm' ), ( 'nop', 'qrs' );
226 CREATE TABLE t2 ( a VARCHAR(10) );
227 INSERT INTO t2 VALUES ( 'abc' ), ( 'klm' );
228 # Test of literals matching.
229 INSERT INTO query_rewrite.rewrite_rules ( pattern, replacement )
230 VALUES ( 'SELECT ?', 'SELECT "literal"' );
231 SELECT * FROM query_rewrite.rewrite_rules;
232 id pattern pattern_database replacement enabled message normalized_pattern
233 10 SELECT ? NULL SELECT "literal" YES NULL NULL
234 CALL query_rewrite.flush_rewrite_rules();
235 SELECT * FROM query_rewrite.rewrite_rules;
236 id pattern pattern_database replacement enabled message normalized_pattern
237 10 SELECT ? NULL SELECT "literal" YES NULL select ?
238 SELECT NULL;
239 literal
240 literal
241 Warnings:
242 Note 1105 Query 'SELECT NULL' rewritten to 'SELECT "literal"' by a query rewrite plugin
243 SELECT 'abc';
244 literal
245 literal
246 Warnings:
247 Note 1105 Query 'SELECT 'abc'' rewritten to 'SELECT "literal"' by a query rewrite plugin
248 SELECT 1;
249 literal
250 literal
251 Warnings:
252 Note 1105 Query 'SELECT 1' rewritten to 'SELECT "literal"' by a query rewrite plugin
253 SELECT 1.1;
254 literal
255 literal
256 Warnings:
257 Note 1105 Query 'SELECT 1.1' rewritten to 'SELECT "literal"' by a query rewrite plugin
258 SELECT 123456789123456789123456789123456789123456789123456789;
259 literal
260 literal
261 Warnings:
262 Note 1105 Query 'SELECT 123456789123456789123456789123456789123456789123456789' rewritten to 'SELECT "literal"' by a query rewrite plugin
263 # Check our status variables.
264 SHOW STATUS LIKE 'Rewriter%';
265 Variable_name Value
266 Rewriter_number_loaded_rules 1
267 Rewriter_number_reloads 5
268 Rewriter_number_rewritten_queries 23
269 Rewriter_reload_error OFF
270 DELETE FROM query_rewrite.rewrite_rules;
271 INSERT INTO query_rewrite.rewrite_rules ( pattern, replacement )
272 VALUES ( 'SELECT * FROM test.t1 WHERE ( a = ? AND TRUE ) OR b = ?',
273 'SELECT a FROM test.t1 WHERE a = ?' ),
274 ( 'SELECT a FROM test.t1',
275 'SELECT * FROM test.t1 WHERE a = \'abc\'' ),
276 ( 'SELECT a FROM test.t1 WHERE b = ?',
277 'SELECT * FROM test.t1 WHERE b = ?' ),
278 ( 'SELECT * FROM test.t2',
279 'SELECT * FROM test.t1 JOIN test.t2 ON t1.a = t2.a' ),
280 ( 'SELECT * FROM test.t1 WHERE a = ? OR b = ?',
281 'SELECT * FROM test.t1 WHERE b = ? OR a = ?' );
282 SELECT * FROM query_rewrite.rewrite_rules;
283 id pattern pattern_database replacement enabled message normalized_pattern
284 11 SELECT * FROM test.t1 WHERE ( a = ? AND TRUE ) OR b = ? NULL SELECT a FROM test.t1 WHERE a = ? YES NULL NULL
285 12 SELECT a FROM test.t1 NULL SELECT * FROM test.t1 WHERE a = 'abc' YES NULL NULL
286 13 SELECT a FROM test.t1 WHERE b = ? NULL SELECT * FROM test.t1 WHERE b = ? YES NULL NULL
287 14 SELECT * FROM test.t2 NULL SELECT * FROM test.t1 JOIN test.t2 ON t1.a = t2.a YES NULL NULL
288 15 SELECT * FROM test.t1 WHERE a = ? OR b = ? NULL SELECT * FROM test.t1 WHERE b = ? OR a = ? YES NULL NULL
289 CALL query_rewrite.flush_rewrite_rules();
290 SELECT * FROM query_rewrite.rewrite_rules;
291 id pattern pattern_database replacement enabled message normalized_pattern
292 11 SELECT * FROM test.t1 WHERE ( a = ? AND TRUE ) OR b = ? NULL SELECT a FROM test.t1 WHERE a = ? YES NULL select `*` from `test`.`t1` where (((`a` = ?) and true) or (`b` = ?))
293 12 SELECT a FROM test.t1 NULL SELECT * FROM test.t1 WHERE a = 'abc' YES NULL select `a` from `test`.`t1`
294 13 SELECT a FROM test.t1 WHERE b = ? NULL SELECT * FROM test.t1 WHERE b = ? YES NULL select `a` from `test`.`t1` where (`b` = ?)
295 14 SELECT * FROM test.t2 NULL SELECT * FROM test.t1 JOIN test.t2 ON t1.a = t2.a YES NULL select `*` from `test`.`t2`
296 15 SELECT * FROM test.t1 WHERE a = ? OR b = ? NULL SELECT * FROM test.t1 WHERE b = ? OR a = ? YES NULL select `*` from `test`.`t1` where ((`a` = ?) or (`b` = ?))
297 # Check a query that doesn't have a rewrite rule doesn't get rewritten.
298 SELECT b FROM test.t1;
299 b
300 def
301 klm
302 qrs
303 # Check a query with just one parameter.
304 SELECT a FROM test.t1 WHERE b = 'qrs';
305 a b
306 nop qrs
307 Warnings:
308 Note 1105 Query 'SELECT a FROM test.t1 WHERE b = 'qrs'' rewritten to 'SELECT * FROM test.t1 WHERE b = 'qrs'' by a query rewrite plugin
309 # Check a rule with parameter truncation (fewer parameters in the
310 # output query than in the input query);
311 SELECT * FROM test.t1 WHERE ( a = 'abc' AND TRUE ) OR b = 'klm';
312 a
313 abc
314 Warnings:
315 Note 1105 Query 'SELECT * FROM test.t1 WHERE ( a = 'abc' AND TRUE ) OR b = 'klm'' rewritten to 'SELECT a FROM test.t1 WHERE a = 'abc'' by a query rewrite plugin
316 SELECT * FROM test.t1 WHERE ( a = 'abc' AND FALSE ) OR b = 'klm';
317 a b
318 ghi klm
319 # Check a non parameterized query.
320 SELECT * from t1 WHERE a = 'abc';
321 a b
322 abc def
323 # Check that a non-rewritten query does not yield a warning.
324 SELECT b FROM test.t1;
325 b
326 def
327 klm
328 qrs
329 # Check that a query is not rewritten if the query corresponds to a
330 # replacement.
331 SELECT a FROM test.t1;
332 a b
333 abc def
334 Warnings:
335 Note 1105 Query 'SELECT a FROM test.t1' rewritten to 'SELECT * FROM test.t1 WHERE a = 'abc'' by a query rewrite plugin
336 # Check that we can execute a rewrite more than once.
337 SELECT * FROM test.t2;
338 a b a
339 abc def abc
340 Warnings:
341 Note 1105 Query 'SELECT * FROM test.t2' rewritten to 'SELECT * FROM test.t1 JOIN test.t2 ON t1.a = t2.a' by a query rewrite plugin
342 SELECT * FROM test.t2;
343 a b a
344 abc def abc
345 Warnings:
346 Note 1105 Query 'SELECT * FROM test.t2' rewritten to 'SELECT * FROM test.t1 JOIN test.t2 ON t1.a = t2.a' by a query rewrite plugin
347 # Remove the warnings.
348 SELECT b FROM test.t1;
349 b
350 def
351 klm
352 qrs
353 # Check parameter switching in a query rewrite
354 SELECT * FROM test.t1 WHERE a = 'def' OR b = 'ghi';
355 a b
356 abc def
357 ghi klm
358 Warnings:
359 Note 1105 Query 'SELECT * FROM test.t1 WHERE a = 'def' OR b = 'ghi'' rewritten to 'SELECT * FROM test.t1 WHERE b = 'def' OR a = 'ghi'' by a query rewrite plugin
360 # Verify with whitespace.
361 SELECT * FROM test.t1 WHERE a = 'def' OR b = 'ghi';
362 a b
363 abc def
364 ghi klm
365 Warnings:
366 Note 1105 Query 'SELECT * FROM test.t1 WHERE a = 'def' OR b = 'ghi'' rewritten to 'SELECT * FROM test.t1 WHERE b = 'def' OR a = 'ghi'' by a query rewrite plugin
367 # Verify with comments.
368 SELECT * FROM test.t1 WHERE a =/* 'def' ? */'def' OR b = 'ghi';
369 a b
370 abc def
371 ghi klm
372 Warnings:
373 Note 1105 Query 'SELECT * FROM test.t1 WHERE a =/* 'def' ? */'def' OR b = 'ghi'' rewritten to 'SELECT * FROM test.t1 WHERE b = 'def' OR a = 'ghi'' by a query rewrite plugin
374 # Check our status variables.
375 SHOW STATUS LIKE 'Rewriter%';
376 Variable_name Value
377 Rewriter_number_loaded_rules 5
378 Rewriter_number_reloads 6
379 Rewriter_number_rewritten_queries 31
380 Rewriter_reload_error OFF
381 DROP TABLE t1;
382 DROP TABLE t2;
383 DELETE FROM query_rewrite.rewrite_rules;
384 # Test of literals matching.
385 INSERT INTO query_rewrite.rewrite_rules ( pattern, replacement )
386 VALUES ( 'SELECT 1, ?', 'SELECT "rewritten w/rule 1"' ),
387 ( 'SELECT 2, ?', 'SELECT "rewritten w/rule 2"' ),
388 ( 'SELECT "The_original_query"', 'SELECT "The_rewritten_query"');
389 SELECT * FROM query_rewrite.rewrite_rules;
390 id pattern pattern_database replacement enabled message normalized_pattern
391 16 SELECT 1, ? NULL SELECT "rewritten w/rule 1" YES NULL NULL
392 17 SELECT 2, ? NULL SELECT "rewritten w/rule 2" YES NULL NULL
393 18 SELECT "The_original_query" NULL SELECT "The_rewritten_query" YES NULL NULL
394 CALL query_rewrite.flush_rewrite_rules();
395 SELECT * FROM query_rewrite.rewrite_rules;
396 id pattern pattern_database replacement enabled message normalized_pattern
397 16 SELECT 1, ? NULL SELECT "rewritten w/rule 1" YES NULL select ?,?
398 17 SELECT 2, ? NULL SELECT "rewritten w/rule 2" YES NULL select ?,?
399 18 SELECT "The_original_query" NULL SELECT "The_rewritten_query" YES NULL select ?
400 SELECT 1, 1;
401 rewritten w/rule 1
402 rewritten w/rule 1
403 Warnings:
404 Note 1105 Query 'SELECT 1, 1' rewritten to 'SELECT "rewritten w/rule 1"' by a query rewrite plugin
405 SELECT 1, 2;
406 rewritten w/rule 1
407 rewritten w/rule 1
408 Warnings:
409 Note 1105 Query 'SELECT 1, 2' rewritten to 'SELECT "rewritten w/rule 1"' by a query rewrite plugin
410 SELECT 2, 1;
411 rewritten w/rule 2
412 rewritten w/rule 2
413 Warnings:
414 Note 1105 Query 'SELECT 2, 1' rewritten to 'SELECT "rewritten w/rule 2"' by a query rewrite plugin
415 SELECT 2, 2;
416 rewritten w/rule 2
417 rewritten w/rule 2
418 Warnings:
419 Note 1105 Query 'SELECT 2, 2' rewritten to 'SELECT "rewritten w/rule 2"' by a query rewrite plugin
420 SELECT 3, 1;
421 3 1
422 3 1
423 SELECT 3, 2;
424 3 2
425 3 2
426 SELECT 'The_original_query';
427 The_rewritten_query
428 The_rewritten_query
429 Warnings:
430 Note 1105 Query 'SELECT 'The_original_query'' rewritten to 'SELECT "The_rewritten_query"' by a query rewrite plugin
431 DELETE FROM query_rewrite.rewrite_rules;
432 DELETE FROM query_rewrite.rewrite_rules;
433 #
434 # Testing with a NORMALIZED_PATTERN column but no MESSAGE column.
435 #
436 ALTER TABLE query_rewrite.rewrite_rules DROP COLUMN message;
437 CREATE TABLE t1 ( a VARCHAR(10), b VARCHAR(10) );
438 INSERT INTO t1 VALUES ( 'abc', 'def' ), ( 'ghi', 'klm' ), ( 'nop', 'qrs' );
439 CREATE TABLE t2 ( a VARCHAR(10) );
440 INSERT INTO t2 VALUES ( 'abc' ), ( 'klm' );
441 # Test of literals matching.
442 INSERT INTO query_rewrite.rewrite_rules ( pattern, replacement )
443 VALUES ( 'SELECT ?', 'SELECT "literal"' );
444 SELECT * FROM query_rewrite.rewrite_rules;
445 id pattern pattern_database replacement enabled normalized_pattern
446 19 SELECT ? NULL SELECT "literal" YES NULL
447 CALL query_rewrite.flush_rewrite_rules();
448 SELECT * FROM query_rewrite.rewrite_rules;
449 id pattern pattern_database replacement enabled normalized_pattern
450 19 SELECT ? NULL SELECT "literal" YES select ?
451 SELECT NULL;
452 literal
453 literal
454 Warnings:
455 Note 1105 Query 'SELECT NULL' rewritten to 'SELECT "literal"' by a query rewrite plugin
456 SELECT 'abc';
457 literal
458 literal
459 Warnings:
460 Note 1105 Query 'SELECT 'abc'' rewritten to 'SELECT "literal"' by a query rewrite plugin
461 SELECT 1;
462 literal
463 literal
464 Warnings:
465 Note 1105 Query 'SELECT 1' rewritten to 'SELECT "literal"' by a query rewrite plugin
466 SELECT 1.1;
467 literal
468 literal
469 Warnings:
470 Note 1105 Query 'SELECT 1.1' rewritten to 'SELECT "literal"' by a query rewrite plugin
471 SELECT 123456789123456789123456789123456789123456789123456789;
472 literal
473 literal
474 Warnings:
475 Note 1105 Query 'SELECT 123456789123456789123456789123456789123456789123456789' rewritten to 'SELECT "literal"' by a query rewrite plugin
476 # Check our status variables.
477 SHOW STATUS LIKE 'Rewriter%';
478 Variable_name Value
479 Rewriter_number_loaded_rules 1
480 Rewriter_number_reloads 8
481 Rewriter_number_rewritten_queries 41
482 Rewriter_reload_error OFF
483 DELETE FROM query_rewrite.rewrite_rules;
484 INSERT INTO query_rewrite.rewrite_rules ( pattern, replacement )
485 VALUES ( 'SELECT * FROM test.t1 WHERE ( a = ? AND TRUE ) OR b = ?',
486 'SELECT a FROM test.t1 WHERE a = ?' ),
487 ( 'SELECT a FROM test.t1',
488 'SELECT * FROM test.t1 WHERE a = \'abc\'' ),
489 ( 'SELECT a FROM test.t1 WHERE b = ?',
490 'SELECT * FROM test.t1 WHERE b = ?' ),
491 ( 'SELECT * FROM test.t2',
492 'SELECT * FROM test.t1 JOIN test.t2 ON t1.a = t2.a' ),
493 ( 'SELECT * FROM test.t1 WHERE a = ? OR b = ?',
494 'SELECT * FROM test.t1 WHERE b = ? OR a = ?' );
495 SELECT * FROM query_rewrite.rewrite_rules;
496 id pattern pattern_database replacement enabled normalized_pattern
497 20 SELECT * FROM test.t1 WHERE ( a = ? AND TRUE ) OR b = ? NULL SELECT a FROM test.t1 WHERE a = ? YES NULL
498 21 SELECT a FROM test.t1 NULL SELECT * FROM test.t1 WHERE a = 'abc' YES NULL
499 22 SELECT a FROM test.t1 WHERE b = ? NULL SELECT * FROM test.t1 WHERE b = ? YES NULL
500 23 SELECT * FROM test.t2 NULL SELECT * FROM test.t1 JOIN test.t2 ON t1.a = t2.a YES NULL
501 24 SELECT * FROM test.t1 WHERE a = ? OR b = ? NULL SELECT * FROM test.t1 WHERE b = ? OR a = ? YES NULL
502 CALL query_rewrite.flush_rewrite_rules();
503 SELECT * FROM query_rewrite.rewrite_rules;
504 id pattern pattern_database replacement enabled normalized_pattern
505 20 SELECT * FROM test.t1 WHERE ( a = ? AND TRUE ) OR b = ? NULL SELECT a FROM test.t1 WHERE a = ? YES select `*` from `test`.`t1` where (((`a` = ?) and true) or (`b` = ?))
506 21 SELECT a FROM test.t1 NULL SELECT * FROM test.t1 WHERE a = 'abc' YES select `a` from `test`.`t1`
507 22 SELECT a FROM test.t1 WHERE b = ? NULL SELECT * FROM test.t1 WHERE b = ? YES select `a` from `test`.`t1` where (`b` = ?)
508 23 SELECT * FROM test.t2 NULL SELECT * FROM test.t1 JOIN test.t2 ON t1.a = t2.a YES select `*` from `test`.`t2`
509 24 SELECT * FROM test.t1 WHERE a = ? OR b = ? NULL SELECT * FROM test.t1 WHERE b = ? OR a = ? YES select `*` from `test`.`t1` where ((`a` = ?) or (`b` = ?))
510 # Check a query that doesn't have a rewrite rule doesn't get rewritten.
511 SELECT b FROM test.t1;
512 b
513 def
514 klm
515 qrs
516 # Check a query with just one parameter.
517 SELECT a FROM test.t1 WHERE b = 'qrs';
518 a b
519 nop qrs
520 Warnings:
521 Note 1105 Query 'SELECT a FROM test.t1 WHERE b = 'qrs'' rewritten to 'SELECT * FROM test.t1 WHERE b = 'qrs'' by a query rewrite plugin
522 # Check a rule with parameter truncation (fewer parameters in the
523 # output query than in the input query);
524 SELECT * FROM test.t1 WHERE ( a = 'abc' AND TRUE ) OR b = 'klm';
525 a
526 abc
527 Warnings:
528 Note 1105 Query 'SELECT * FROM test.t1 WHERE ( a = 'abc' AND TRUE ) OR b = 'klm'' rewritten to 'SELECT a FROM test.t1 WHERE a = 'abc'' by a query rewrite plugin
529 SELECT * FROM test.t1 WHERE ( a = 'abc' AND FALSE ) OR b = 'klm';
530 a b
531 ghi klm
532 # Check a non parameterized query.
533 SELECT * from t1 WHERE a = 'abc';
534 a b
535 abc def
536 # Check that a non-rewritten query does not yield a warning.
537 SELECT b FROM test.t1;
538 b
539 def
540 klm
541 qrs
542 # Check that a query is not rewritten if the query corresponds to a
543 # replacement.
544 SELECT a FROM test.t1;
545 a b
546 abc def
547 Warnings:
548 Note 1105 Query 'SELECT a FROM test.t1' rewritten to 'SELECT * FROM test.t1 WHERE a = 'abc'' by a query rewrite plugin
549 # Check that we can execute a rewrite more than once.
550 SELECT * FROM test.t2;
551 a b a
552 abc def abc
553 Warnings:
554 Note 1105 Query 'SELECT * FROM test.t2' rewritten to 'SELECT * FROM test.t1 JOIN test.t2 ON t1.a = t2.a' by a query rewrite plugin
555 SELECT * FROM test.t2;
556 a b a
557 abc def abc
558 Warnings:
559 Note 1105 Query 'SELECT * FROM test.t2' rewritten to 'SELECT * FROM test.t1 JOIN test.t2 ON t1.a = t2.a' by a query rewrite plugin
560 # Remove the warnings.
561 SELECT b FROM test.t1;
562 b
563 def
564 klm
565 qrs
566 # Check parameter switching in a query rewrite
567 SELECT * FROM test.t1 WHERE a = 'def' OR b = 'ghi';
568 a b
569 abc def
570 ghi klm
571 Warnings:
572 Note 1105 Query 'SELECT * FROM test.t1 WHERE a = 'def' OR b = 'ghi'' rewritten to 'SELECT * FROM test.t1 WHERE b = 'def' OR a = 'ghi'' by a query rewrite plugin
573 # Verify with whitespace.
574 SELECT * FROM test.t1 WHERE a = 'def' OR b = 'ghi';
575 a b
576 abc def
577 ghi klm
578 Warnings:
579 Note 1105 Query 'SELECT * FROM test.t1 WHERE a = 'def' OR b = 'ghi'' rewritten to 'SELECT * FROM test.t1 WHERE b = 'def' OR a = 'ghi'' by a query rewrite plugin
580 # Verify with comments.
581 SELECT * FROM test.t1 WHERE a =/* 'def' ? */'def' OR b = 'ghi';
582 a b
583 abc def
584 ghi klm
585 Warnings:
586 Note 1105 Query 'SELECT * FROM test.t1 WHERE a =/* 'def' ? */'def' OR b = 'ghi'' rewritten to 'SELECT * FROM test.t1 WHERE b = 'def' OR a = 'ghi'' by a query rewrite plugin
587 # Check our status variables.
588 SHOW STATUS LIKE 'Rewriter%';
589 Variable_name Value
590 Rewriter_number_loaded_rules 5
591 Rewriter_number_reloads 9
592 Rewriter_number_rewritten_queries 49
593 Rewriter_reload_error OFF
594 DROP TABLE t1;
595 DROP TABLE t2;
596 DELETE FROM query_rewrite.rewrite_rules;
597 # Test of literals matching.
598 INSERT INTO query_rewrite.rewrite_rules ( pattern, replacement )
599 VALUES ( 'SELECT 1, ?', 'SELECT "rewritten w/rule 1"' ),
600 ( 'SELECT 2, ?', 'SELECT "rewritten w/rule 2"' ),
601 ( 'SELECT "The_original_query"', 'SELECT "The_rewritten_query"');
602 SELECT * FROM query_rewrite.rewrite_rules;
603 id pattern pattern_database replacement enabled normalized_pattern
604 25 SELECT 1, ? NULL SELECT "rewritten w/rule 1" YES NULL
605 26 SELECT 2, ? NULL SELECT "rewritten w/rule 2" YES NULL
606 27 SELECT "The_original_query" NULL SELECT "The_rewritten_query" YES NULL
607 CALL query_rewrite.flush_rewrite_rules();
608 SELECT * FROM query_rewrite.rewrite_rules;
609 id pattern pattern_database replacement enabled normalized_pattern
610 25 SELECT 1, ? NULL SELECT "rewritten w/rule 1" YES select ?,?
611 26 SELECT 2, ? NULL SELECT "rewritten w/rule 2" YES select ?,?
612 27 SELECT "The_original_query" NULL SELECT "The_rewritten_query" YES select ?
613 SELECT 1, 1;
614 rewritten w/rule 1
615 rewritten w/rule 1
616 Warnings:
617 Note 1105 Query 'SELECT 1, 1' rewritten to 'SELECT "rewritten w/rule 1"' by a query rewrite plugin
618 SELECT 1, 2;
619 rewritten w/rule 1
620 rewritten w/rule 1
621 Warnings:
622 Note 1105 Query 'SELECT 1, 2' rewritten to 'SELECT "rewritten w/rule 1"' by a query rewrite plugin
623 SELECT 2, 1;
624 rewritten w/rule 2
625 rewritten w/rule 2
626 Warnings:
627 Note 1105 Query 'SELECT 2, 1' rewritten to 'SELECT "rewritten w/rule 2"' by a query rewrite plugin
628 SELECT 2, 2;
629 rewritten w/rule 2
630 rewritten w/rule 2
631 Warnings:
632 Note 1105 Query 'SELECT 2, 2' rewritten to 'SELECT "rewritten w/rule 2"' by a query rewrite plugin
633 SELECT 3, 1;
634 3 1
635 3 1
636 SELECT 3, 2;
637 3 2
638 3 2
639 SELECT 'The_original_query';
640 The_rewritten_query
641 The_rewritten_query
642 Warnings:
643 Note 1105 Query 'SELECT 'The_original_query'' rewritten to 'SELECT "The_rewritten_query"' by a query rewrite plugin
644 DELETE FROM query_rewrite.rewrite_rules;
645 DELETE FROM query_rewrite.rewrite_rules;
646 #
647 # Testing with no optional columns.
648 #
649 ALTER TABLE query_rewrite.rewrite_rules DROP COLUMN normalized_pattern;
650 CREATE TABLE t1 ( a VARCHAR(10), b VARCHAR(10) );
651 INSERT INTO t1 VALUES ( 'abc', 'def' ), ( 'ghi', 'klm' ), ( 'nop', 'qrs' );
652 CREATE TABLE t2 ( a VARCHAR(10) );
653 INSERT INTO t2 VALUES ( 'abc' ), ( 'klm' );
654 # Test of literals matching.
655 INSERT INTO query_rewrite.rewrite_rules ( pattern, replacement )
656 VALUES ( 'SELECT ?', 'SELECT "literal"' );
657 SELECT * FROM query_rewrite.rewrite_rules;
658 id pattern pattern_database replacement enabled
659 28 SELECT ? NULL SELECT "literal" YES
660 CALL query_rewrite.flush_rewrite_rules();
661 SELECT * FROM query_rewrite.rewrite_rules;
662 id pattern pattern_database replacement enabled
663 28 SELECT ? NULL SELECT "literal" YES
664 SELECT NULL;
665 literal
666 literal
667 Warnings:
668 Note 1105 Query 'SELECT NULL' rewritten to 'SELECT "literal"' by a query rewrite plugin
669 SELECT 'abc';
670 literal
671 literal
672 Warnings:
673 Note 1105 Query 'SELECT 'abc'' rewritten to 'SELECT "literal"' by a query rewrite plugin
674 SELECT 1;
675 literal
676 literal
677 Warnings:
678 Note 1105 Query 'SELECT 1' rewritten to 'SELECT "literal"' by a query rewrite plugin
679 SELECT 1.1;
680 literal
681 literal
682 Warnings:
683 Note 1105 Query 'SELECT 1.1' rewritten to 'SELECT "literal"' by a query rewrite plugin
684 SELECT 123456789123456789123456789123456789123456789123456789;
685 literal
686 literal
687 Warnings:
688 Note 1105 Query 'SELECT 123456789123456789123456789123456789123456789123456789' rewritten to 'SELECT "literal"' by a query rewrite plugin
689 # Check our status variables.
690 SHOW STATUS LIKE 'Rewriter%';
691 Variable_name Value
692 Rewriter_number_loaded_rules 1
693 Rewriter_number_reloads 11
694 Rewriter_number_rewritten_queries 59
695 Rewriter_reload_error OFF
696 DELETE FROM query_rewrite.rewrite_rules;
697 INSERT INTO query_rewrite.rewrite_rules ( pattern, replacement )
698 VALUES ( 'SELECT * FROM test.t1 WHERE ( a = ? AND TRUE ) OR b = ?',
699 'SELECT a FROM test.t1 WHERE a = ?' ),
700 ( 'SELECT a FROM test.t1',
701 'SELECT * FROM test.t1 WHERE a = \'abc\'' ),
702 ( 'SELECT a FROM test.t1 WHERE b = ?',
703 'SELECT * FROM test.t1 WHERE b = ?' ),
704 ( 'SELECT * FROM test.t2',
705 'SELECT * FROM test.t1 JOIN test.t2 ON t1.a = t2.a' ),
706 ( 'SELECT * FROM test.t1 WHERE a = ? OR b = ?',
707 'SELECT * FROM test.t1 WHERE b = ? OR a = ?' );
708 SELECT * FROM query_rewrite.rewrite_rules;
709 id pattern pattern_database replacement enabled
710 29 SELECT * FROM test.t1 WHERE ( a = ? AND TRUE ) OR b = ? NULL SELECT a FROM test.t1 WHERE a = ? YES
711 30 SELECT a FROM test.t1 NULL SELECT * FROM test.t1 WHERE a = 'abc' YES
712 31 SELECT a FROM test.t1 WHERE b = ? NULL SELECT * FROM test.t1 WHERE b = ? YES
713 32 SELECT * FROM test.t2 NULL SELECT * FROM test.t1 JOIN test.t2 ON t1.a = t2.a YES
714 33 SELECT * FROM test.t1 WHERE a = ? OR b = ? NULL SELECT * FROM test.t1 WHERE b = ? OR a = ? YES
715 CALL query_rewrite.flush_rewrite_rules();
716 SELECT * FROM query_rewrite.rewrite_rules;
717 id pattern pattern_database replacement enabled
718 29 SELECT * FROM test.t1 WHERE ( a = ? AND TRUE ) OR b = ? NULL SELECT a FROM test.t1 WHERE a = ? YES
719 30 SELECT a FROM test.t1 NULL SELECT * FROM test.t1 WHERE a = 'abc' YES
720 31 SELECT a FROM test.t1 WHERE b = ? NULL SELECT * FROM test.t1 WHERE b = ? YES
721 32 SELECT * FROM test.t2 NULL SELECT * FROM test.t1 JOIN test.t2 ON t1.a = t2.a YES
722 33 SELECT * FROM test.t1 WHERE a = ? OR b = ? NULL SELECT * FROM test.t1 WHERE b = ? OR a = ? YES
723 # Check a query that doesn't have a rewrite rule doesn't get rewritten.
724 SELECT b FROM test.t1;
725 b
726 def
727 klm
728 qrs
729 # Check a query with just one parameter.
730 SELECT a FROM test.t1 WHERE b = 'qrs';
731 a b
732 nop qrs
733 Warnings:
734 Note 1105 Query 'SELECT a FROM test.t1 WHERE b = 'qrs'' rewritten to 'SELECT * FROM test.t1 WHERE b = 'qrs'' by a query rewrite plugin
735 # Check a rule with parameter truncation (fewer parameters in the
736 # output query than in the input query);
737 SELECT * FROM test.t1 WHERE ( a = 'abc' AND TRUE ) OR b = 'klm';
738 a
739 abc
740 Warnings:
741 Note 1105 Query 'SELECT * FROM test.t1 WHERE ( a = 'abc' AND TRUE ) OR b = 'klm'' rewritten to 'SELECT a FROM test.t1 WHERE a = 'abc'' by a query rewrite plugin
742 SELECT * FROM test.t1 WHERE ( a = 'abc' AND FALSE ) OR b = 'klm';
743 a b
744 ghi klm
745 # Check a non parameterized query.
746 SELECT * from t1 WHERE a = 'abc';
747 a b
748 abc def
749 # Check that a non-rewritten query does not yield a warning.
750 SELECT b FROM test.t1;
751 b
752 def
753 klm
754 qrs
755 # Check that a query is not rewritten if the query corresponds to a
756 # replacement.
757 SELECT a FROM test.t1;
758 a b
759 abc def
760 Warnings:
761 Note 1105 Query 'SELECT a FROM test.t1' rewritten to 'SELECT * FROM test.t1 WHERE a = 'abc'' by a query rewrite plugin
762 # Check that we can execute a rewrite more than once.
763 SELECT * FROM test.t2;
764 a b a
765 abc def abc
766 Warnings:
767 Note 1105 Query 'SELECT * FROM test.t2' rewritten to 'SELECT * FROM test.t1 JOIN test.t2 ON t1.a = t2.a' by a query rewrite plugin
768 SELECT * FROM test.t2;
769 a b a
770 abc def abc
771 Warnings:
772 Note 1105 Query 'SELECT * FROM test.t2' rewritten to 'SELECT * FROM test.t1 JOIN test.t2 ON t1.a = t2.a' by a query rewrite plugin
773 # Remove the warnings.
774 SELECT b FROM test.t1;
775 b
776 def
777 klm
778 qrs
779 # Check parameter switching in a query rewrite
780 SELECT * FROM test.t1 WHERE a = 'def' OR b = 'ghi';
781 a b
782 abc def
783 ghi klm
784 Warnings:
785 Note 1105 Query 'SELECT * FROM test.t1 WHERE a = 'def' OR b = 'ghi'' rewritten to 'SELECT * FROM test.t1 WHERE b = 'def' OR a = 'ghi'' by a query rewrite plugin
786 # Verify with whitespace.
787 SELECT * FROM test.t1 WHERE a = 'def' OR b = 'ghi';
788 a b
789 abc def
790 ghi klm
791 Warnings:
792 Note 1105 Query 'SELECT * FROM test.t1 WHERE a = 'def' OR b = 'ghi'' rewritten to 'SELECT * FROM test.t1 WHERE b = 'def' OR a = 'ghi'' by a query rewrite plugin
793 # Verify with comments.
794 SELECT * FROM test.t1 WHERE a =/* 'def' ? */'def' OR b = 'ghi';
795 a b
796 abc def
797 ghi klm
798 Warnings:
799 Note 1105 Query 'SELECT * FROM test.t1 WHERE a =/* 'def' ? */'def' OR b = 'ghi'' rewritten to 'SELECT * FROM test.t1 WHERE b = 'def' OR a = 'ghi'' by a query rewrite plugin
800 # Check our status variables.
801 SHOW STATUS LIKE 'Rewriter%';
802 Variable_name Value
803 Rewriter_number_loaded_rules 5
804 Rewriter_number_reloads 12
805 Rewriter_number_rewritten_queries 67
806 Rewriter_reload_error OFF
807 DROP TABLE t1;
808 DROP TABLE t2;
809 DELETE FROM query_rewrite.rewrite_rules;
810 # Test of literals matching.
811 INSERT INTO query_rewrite.rewrite_rules ( pattern, replacement )
812 VALUES ( 'SELECT 1, ?', 'SELECT "rewritten w/rule 1"' ),
813 ( 'SELECT 2, ?', 'SELECT "rewritten w/rule 2"' ),
814 ( 'SELECT "The_original_query"', 'SELECT "The_rewritten_query"');
815 SELECT * FROM query_rewrite.rewrite_rules;
816 id pattern pattern_database replacement enabled
817 34 SELECT 1, ? NULL SELECT "rewritten w/rule 1" YES
818 35 SELECT 2, ? NULL SELECT "rewritten w/rule 2" YES
819 36 SELECT "The_original_query" NULL SELECT "The_rewritten_query" YES
820 CALL query_rewrite.flush_rewrite_rules();
821 SELECT * FROM query_rewrite.rewrite_rules;
822 id pattern pattern_database replacement enabled
823 34 SELECT 1, ? NULL SELECT "rewritten w/rule 1" YES
824 35 SELECT 2, ? NULL SELECT "rewritten w/rule 2" YES
825 36 SELECT "The_original_query" NULL SELECT "The_rewritten_query" YES
826 SELECT 1, 1;
827 rewritten w/rule 1
828 rewritten w/rule 1
829 Warnings:
830 Note 1105 Query 'SELECT 1, 1' rewritten to 'SELECT "rewritten w/rule 1"' by a query rewrite plugin
831 SELECT 1, 2;
832 rewritten w/rule 1
833 rewritten w/rule 1
834 Warnings:
835 Note 1105 Query 'SELECT 1, 2' rewritten to 'SELECT "rewritten w/rule 1"' by a query rewrite plugin
836 SELECT 2, 1;
837 rewritten w/rule 2
838 rewritten w/rule 2
839 Warnings:
840 Note 1105 Query 'SELECT 2, 1' rewritten to 'SELECT "rewritten w/rule 2"' by a query rewrite plugin
841 SELECT 2, 2;
842 rewritten w/rule 2
843 rewritten w/rule 2
844 Warnings:
845 Note 1105 Query 'SELECT 2, 2' rewritten to 'SELECT "rewritten w/rule 2"' by a query rewrite plugin
846 SELECT 3, 1;
847 3 1
848 3 1
849 SELECT 3, 2;
850 3 2
851 3 2
852 SELECT 'The_original_query';
853 The_rewritten_query
854 The_rewritten_query
855 Warnings:
856 Note 1105 Query 'SELECT 'The_original_query'' rewritten to 'SELECT "The_rewritten_query"' by a query rewrite plugin
857 DELETE FROM query_rewrite.rewrite_rules;
858 DELETE FROM query_rewrite.rewrite_rules;
859 Warnings:
860 Warning 1620 Plugin is busy and will be uninstalled on shutdown
861 # Query rewrite plugin was queued for uninstalling.