Server IP : 172.67.216.182 / Your IP : 172.70.92.140 Web Server : Apache System : Linux krdc-ubuntu-s-2vcpu-4gb-amd-blr1-01.localdomain 5.15.0-142-generic #152-Ubuntu SMP Mon May 19 10:54:31 UTC 2025 x86_64 User : www ( 1000) PHP Version : 7.4.33 Disable Function : passthru,exec,system,putenv,chroot,chgrp,chown,shell_exec,popen,proc_open,pcntl_exec,ini_alter,ini_restore,dl,openlog,syslog,readlink,symlink,popepassthru,pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,imap_open,apache_setenv MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : OFF | Sudo : ON | Pkexec : ON Directory : /www/server/mysql/src/mysql-test/suite/query_rewrite_plugins/r/ |
Upload File : |
# # 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.