Description:
It would be nice if I could use the Rewriter plugin to also rewrite SHOW queries.
How to repeat:
INSERT INTO query_rewrite.rewrite_rules(pattern,replacement)
VALUES('SHOW active','SELECT * FROM information_schema.processlist WHERE command<>''SLEEP''');
CALL query_rewrite.flush_rewrite_rules();
mysql [127.0.0.1] {msandbox} (query_rewrite) > SELECT * FROM query_rewrite.rewrite_rules WHERE pattern='SHOW active'\G
*************************** 1. row ***************************
id: 9
pattern: SHOW active
pattern_database: NULL
replacement: SELECT * FROM information_schema.processlist WHERE command<>'SLEEP'
enabled: YES
message: Parse error in pattern: >>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 'active' at line 1<<
pattern_digest: NULL
normalized_pattern: NULL
1 row in set (0.00 sec)
mysql [127.0.0.1] {msandbox} (query_rewrite) > SELECT * FROM query_rewrite.rewrite_rules WHERE pattern='SHOW ?'\G
*************************** 1. row ***************************
id: 10
pattern: SHOW ?
pattern_database: NULL
replacement: SELECT * FROM information_schema.processlist WHERE command<>'SLEEP'
enabled: YES
message: Parse error in pattern: >>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 '?' at line 1<<
pattern_digest: NULL
normalized_pattern: NULL
1 row in set (0.00 sec)
mysql [127.0.0.1] {msandbox} (query_rewrite) > SELECT * FROM query_rewrite.rewrite_rules WHERE pattern='SHOW PROCESSLIST'\G
*************************** 1. row ***************************
id: 11
pattern: SHOW PROCESSLIST
pattern_database: NULL
replacement: SELECT * FROM information_schema.processlist WHERE command<>'SLEEP'
enabled: YES
message: Pattern needs to be a a select statement.
pattern_digest: NULL
normalized_pattern: NULL
1 row in set (0.00 sec)