| 1 |
# |
| 2 |
# Test of deletion of rules. |
| 3 |
# |
| 4 |
CREATE TABLE t1 ( c1 VARCHAR(10) ); |
| 5 |
INSERT INTO t1 VALUES ( 'abc' ), ( 'def' ); |
| 6 |
CREATE TABLE t2 ( c1 VARCHAR(10) ); |
| 7 |
INSERT INTO t2 VALUES ( '123' ), ( '456' ); |
| 8 |
# Query rewrite plugin was installed. |
| 9 |
INSERT INTO query_rewrite.rewrite_rules ( pattern, replacement ) |
| 10 |
VALUES ( 'SELECT * FROM test.t1', 'SELECT * FROM test.t2' ); |
| 11 |
CALL query_rewrite.flush_rewrite_rules(); |
| 12 |
# Check that the rewrite rule is executed. |
| 13 |
SELECT * FROM test.t1; |
| 14 |
c1 |
| 15 |
123 |
| 16 |
456 |
| 17 |
Warnings: |
| 18 |
Note 1105 Query 'SELECT * FROM test.t1' rewritten to 'SELECT * FROM test.t2' by a query rewrite plugin |
| 19 |
DELETE FROM query_rewrite.rewrite_rules |
| 20 |
WHERE pattern = 'SELECT * FROM test.t1'; |
| 21 |
CALL query_rewrite.flush_rewrite_rules(); |
| 22 |
# Check that the rewrite rule is not executed. |
| 23 |
SELECT * FROM test.t1; |
| 24 |
c1 |
| 25 |
abc |
| 26 |
def |
| 27 |
DROP TABLE t1, t2; |
| 28 |
Warnings: |
| 29 |
Warning 1620 Plugin is busy and will be uninstalled on shutdown |
| 30 |
# Query rewrite plugin was queued for uninstalling. |