| 1 |
--echo # |
| 2 |
--echo # Test of rules where the parser gives warnings about the originial |
| 3 |
--echo # query, pattern or replacement. |
| 4 |
--echo # |
| 5 |
|
| 6 |
call mtr.add_suppression("Plugin rewriter reported: 'Some rules failed to load.'"); |
| 7 |
|
| 8 |
--source suite/query_rewrite_plugins/include/have_plugin_rewriter.inc |
| 9 |
--source suite/query_rewrite_plugins/include/install_rewriter.inc |
| 10 |
|
| 11 |
# Still many unsupported statements |
| 12 |
INSERT INTO query_rewrite.rewrite_rules ( pattern, replacement ) |
| 13 |
VALUES ( 'LOAD DATA INFILE "tab1.data" INTO TABLE test.t1', |
| 14 |
'LOAD DATA INFILE "tab2.data" INTO TABLE test.t1' ), |
| 15 |
( 'DO CONCAT("a", "b")', 'DO CONCAT("c", "d")' ); |
| 16 |
|
| 17 |
--error ER_SIGNAL_EXCEPTION |
| 18 |
CALL query_rewrite.flush_rewrite_rules(); |
| 19 |
SELECT * FROM query_rewrite.rewrite_rules; |
| 20 |
|
| 21 |
INSERT INTO query_rewrite.rewrite_rules ( pattern, replacement ) |
| 22 |
VALUES ( 'SHOW WARNINGS', 'SHOW /* I rewrote it */ WARNINGS' ); |
| 23 |
|
| 24 |
--error ER_SIGNAL_EXCEPTION |
| 25 |
CALL query_rewrite.flush_rewrite_rules(); |
| 26 |
|
| 27 |
--echo # We want the note about the query being rewritten here ... |
| 28 |
SHOW WARNINGS; |
| 29 |
SHOW ERRORS; |
| 30 |
GET DIAGNOSTICS CONDITION 1 @p1 = RETURNED_SQLSTATE, @p2 = MESSAGE_TEXT; |
| 31 |
SELECT @p1; |
| 32 |
SELECT @p2; |
| 33 |
|
| 34 |
--echo # ... but not here, since we failed parsing after seeing SHOW WARNINGS. |
| 35 |
--error ER_PARSE_ERROR |
| 36 |
SHOW WARNINGS and give me a parse error, please; |
| 37 |
|
| 38 |
DELETE FROM query_rewrite.rewrite_rules; |
| 39 |
|
| 40 |
--echo # Test of warnings when we rewrite the diagnostics statement. echo # |
| 41 |
--echo # We disable mtr's SHOW WARNINGS here, as it would just be confusing |
| 42 |
--echo # when it gets rewritten without us seeing it. |
| 43 |
--disable_warnings |
| 44 |
INSERT INTO query_rewrite.rewrite_rules ( pattern, replacement ) |
| 45 |
VALUES ( 'SHOW WARNINGS', 'SELECT "used to be SHOW WARNINGS"' ), |
| 46 |
( 'SELECT 1', 'SHOW WARNINGS' ); |
| 47 |
|
| 48 |
--error ER_SIGNAL_EXCEPTION |
| 49 |
CALL query_rewrite.flush_rewrite_rules(); |
| 50 |
|
| 51 |
SELECT 1; |
| 52 |
|
| 53 |
SHOW WARNINGS; |
| 54 |
|
| 55 |
--enable_warnings |
| 56 |
--source suite/query_rewrite_plugins/include/uninstall_rewriter.inc |