Current Path : /home/usr.opt/mysql57/mysql-test/suite/query_rewrite_plugins/r/ |
FreeBSD hs32.drive.ne.jp 9.1-RELEASE FreeBSD 9.1-RELEASE #1: Wed Jan 14 12:18:08 JST 2015 root@hs32.drive.ne.jp:/sys/amd64/compile/hs32 amd64 |
Current File : //home/usr.opt/mysql57/mysql-test/suite/query_rewrite_plugins/r/warnings.result |
# # Test of rules where the parser gives warnings about the originial # query, pattern or replacement. # # Most of these tests are pointless unless the plugin accepts insert # statements as pattern, which it currently does not. call mtr.add_suppression("Plugin rewriter reported: 'Some rules failed to load.'"); Warnings: Warning 1681 'RESET QUERY CACHE' is deprecated and will be removed in a future release. Warnings: Warning 1681 'RESET QUERY CACHE' is deprecated and will be removed in a future release. # Query rewrite plugin was installed. # In rule 1, we get a warning during parsing of the replacement. # In rule 2, we get a warning during parsing of the pattern. INSERT INTO query_rewrite.rewrite_rules ( pattern, replacement ) VALUES ( 'INSERT INTO test.t1 VALUES ( ? )', 'INSERT DELAYED INTO test.t1 VALUES ( ? )' ), ( 'INSERT DELAYED INTO test.t1 VALUES ( ? )', 'INSERT INTO test.t1 VALUES ( ? )' ); CALL query_rewrite.flush_rewrite_rules(); ERROR 45000: Loading of some rule(s) failed. SELECT * FROM query_rewrite.rewrite_rules; id pattern pattern_database replacement enabled message 1 INSERT INTO test.t1 VALUES ( ? ) NULL INSERT DELAYED INTO test.t1 VALUES ( ? ) YES Pattern needs to be a a select statement. 2 INSERT DELAYED INTO test.t1 VALUES ( ? ) NULL INSERT INTO test.t1 VALUES ( ? ) YES Pattern needs to be a a select statement. CREATE TABLE t1 ( a INT ); # This will translate into INSERT DELAYED, which causes the parser to # warn. INSERT INTO test.t1 VALUES ( 1 ); # Here we get a warning during the parsing of the original query. INSERT DELAYED INTO test.t1 VALUES ( 1 ); Warnings: Warning 3005 INSERT DELAYED is no longer supported. The statement was converted to INSERT. INSERT INTO query_rewrite.rewrite_rules ( pattern, replacement ) VALUES ( 'SHOW WARNINGS', 'SHOW /* I rewrote it */ WARNINGS' ); CALL query_rewrite.flush_rewrite_rules(); ERROR 45000: Loading of some rule(s) failed. # We want the note about the query being rewritten here ... SHOW WARNINGS; Level Code Message Error 1644 Loading of some rule(s) failed. SHOW ERRORS; Level Code Message Error 1644 Loading of some rule(s) failed. GET DIAGNOSTICS CONDITION 1 @p1 = RETURNED_SQLSTATE, @p2 = MESSAGE_TEXT; SELECT @p1; @p1 45000 SELECT @p2; @p2 Loading of some rule(s) failed. # ... but not here, since we failed parsing after seeing SHOW WARNINGS. SHOW WARNINGS and give me a parse error, please; ERROR 42000: You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'and give me a parse error, please' at line 1 DELETE FROM query_rewrite.rewrite_rules; # Test of warnings when we rewrite the diagnostics statement. echo # # We disable mtr's SHOW WARNINGS here, as it would just be confusing # when it gets rewritten without us seeing it. INSERT INTO query_rewrite.rewrite_rules ( pattern, replacement ) VALUES ( 'SHOW WARNINGS', 'SELECT "used to be SHOW WARNINGS"' ), ( 'SELECT 1', 'SHOW WARNINGS' ); CALL query_rewrite.flush_rewrite_rules(); ERROR 45000: Loading of some rule(s) failed. SELECT 1; Level Code Message Error 1644 Loading of some rule(s) failed. Note 1105 Query 'SELECT 1' rewritten to 'SHOW WARNINGS' by a query rewrite plugin SHOW WARNINGS; Level Code Message Error 1644 Loading of some rule(s) failed. Note 1105 Query 'SELECT 1' rewritten to 'SHOW WARNINGS' by a query rewrite plugin DROP TABLE t1; Warnings: Warning 1620 Plugin is busy and will be uninstalled on shutdown # Query rewrite plugin was queued for uninstalling.