File: schema.result

package info (click to toggle)
mysql-8.0 8.0.43-3
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,273,924 kB
  • sloc: cpp: 4,684,605; ansic: 412,450; pascal: 108,398; java: 83,641; perl: 30,221; cs: 27,067; sql: 26,594; sh: 24,181; python: 21,816; yacc: 17,169; php: 11,522; xml: 7,388; javascript: 7,076; makefile: 2,194; lex: 1,075; awk: 670; asm: 520; objc: 183; ruby: 97; lisp: 86
file content (124 lines) | stat: -rw-r--r-- 5,050 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
#
# Test of rewrites of queries where the database (a.k.a. schema) is not
# specified in the pattern.
#
# MySQL behaves in the most peculiar way in this respect. Some
# explanation is order here: When a query is parsed, the
# parser injects the current database when parsing a table name, i.e.
# 'table' is _parsed_ as '<current database>.table'.
#
# The session that loads the rules has no current database, so the rule
# has to specify it if there are unqualified table names in the pattern.
#
CALL mtr.add_suppression("Plugin rewriter reported: 'Some rules failed to load.'");
CREATE DATABASE db1;
CREATE DATABASE db2;
CREATE TABLE t1 ( a VARCHAR(23) );
INSERT INTO t1 VALUES ( 'This was not rewritten.' );
# Query rewrite plugin was installed.
INSERT
INTO query_rewrite.rewrite_rules ( pattern, pattern_database, replacement )
VALUES ( 'SELECT * FROM db1.nonexistent_table1', NULL, 'SELECT "Rule #1"' ),
( 'SELECT * FROM db2.nonexistent_table2', NULL, 'SELECT "Rule #2"' ),
( 'SELECT * FROM nonexistent_table_db1', 'db1', 'SELECT "Rule #3"' ),
( 'SELECT * FROM nonexistent_table_db2', 'db2', 'SELECT "Rule #4"' ),
( 'SELECT * FROM nonexistent_table',      NULL, 'SELECT "Rule #5"' ),
( 'SELECT * FROM test.t1',              'test', 'SELECT "Rule #6"' ),
( 'SELECT 1 FROM t1',                   'test', 'SELECT 4 FROM t1' ),
( 'SELECT 2 FROM t1',                     NULL, 'SELECT 5 FROM t1' ),
( 'SELECT 3 FROM test.t1',                NULL, 'SELECT 6 FROM t1' );
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	SELECT * FROM db1.nonexistent_table1	NULL	SELECT "Rule #1"	YES	NULL
2	SELECT * FROM db2.nonexistent_table2	NULL	SELECT "Rule #2"	YES	NULL
3	SELECT * FROM nonexistent_table_db1	db1	SELECT "Rule #3"	YES	NULL
4	SELECT * FROM nonexistent_table_db2	db2	SELECT "Rule #4"	YES	NULL
5	SELECT * FROM nonexistent_table	NULL	SELECT "Rule #5"	YES	Parse error in pattern: >>No database selected<<
6	SELECT * FROM test.t1	test	SELECT "Rule #6"	YES	NULL
7	SELECT 1 FROM t1	test	SELECT 4 FROM t1	YES	NULL
8	SELECT 2 FROM t1	NULL	SELECT 5 FROM t1	YES	Parse error in pattern: >>No database selected<<
9	SELECT 3 FROM test.t1	NULL	SELECT 6 FROM t1	YES	Parse error in replacement: >>No database selected<<
USE test;
SELECT * FROM db1.nonexistent_table1;
Rule #1
Rule #1
Warnings:
Note	1105	Query 'SELECT * FROM db1.nonexistent_table1' rewritten to 'SELECT "Rule #1"' by a query rewrite plugin
SELECT * FROM db2.nonexistent_table2;
Rule #2
Rule #2
Warnings:
Note	1105	Query 'SELECT * FROM db2.nonexistent_table2' rewritten to 'SELECT "Rule #2"' by a query rewrite plugin
SELECT * FROM nonexistent_table_db1;
ERROR 42S02: Table 'test.nonexistent_table_db1' doesn't exist
SELECT * FROM nonexistent_table_db2;
ERROR 42S02: Table 'test.nonexistent_table_db2' doesn't exist
SELECT * FROM test.t1;
Rule #6
Rule #6
Warnings:
Note	1105	Query 'SELECT * FROM test.t1' rewritten to 'SELECT "Rule #6"' by a query rewrite plugin
SELECT 1 FROM t1;
4
4
Warnings:
Note	1105	Query 'SELECT 1 FROM t1' rewritten to 'SELECT 4 FROM t1' by a query rewrite plugin
USE db1;
SELECT * FROM db1.nonexistent_table1;
Rule #1
Rule #1
Warnings:
Note	1105	Query 'SELECT * FROM db1.nonexistent_table1' rewritten to 'SELECT "Rule #1"' by a query rewrite plugin
SELECT * FROM db2.nonexistent_table2;
Rule #2
Rule #2
Warnings:
Note	1105	Query 'SELECT * FROM db2.nonexistent_table2' rewritten to 'SELECT "Rule #2"' by a query rewrite plugin
SELECT * FROM nonexistent_table_db1;
Rule #3
Rule #3
Warnings:
Note	1105	Query 'SELECT * FROM nonexistent_table_db1' rewritten to 'SELECT "Rule #3"' by a query rewrite plugin
SELECT * FROM nonexistent_table_db2;
ERROR 42S02: Table 'db1.nonexistent_table_db2' doesn't exist
SELECT * FROM test.t1;
Rule #6
Rule #6
Warnings:
Note	1105	Query 'SELECT * FROM test.t1' rewritten to 'SELECT "Rule #6"' by a query rewrite plugin
SELECT 1 FROM t1;
ERROR 42S02: Table 'db1.t1' doesn't exist
USE db2;
SELECT * FROM db1.nonexistent_table1;
Rule #1
Rule #1
Warnings:
Note	1105	Query 'SELECT * FROM db1.nonexistent_table1' rewritten to 'SELECT "Rule #1"' by a query rewrite plugin
SELECT * FROM db2.nonexistent_table2;
Rule #2
Rule #2
Warnings:
Note	1105	Query 'SELECT * FROM db2.nonexistent_table2' rewritten to 'SELECT "Rule #2"' by a query rewrite plugin
SELECT * FROM nonexistent_table_db1;
ERROR 42S02: Table 'db2.nonexistent_table_db1' doesn't exist
SELECT * FROM nonexistent_table_db2;
Rule #4
Rule #4
Warnings:
Note	1105	Query 'SELECT * FROM nonexistent_table_db2' rewritten to 'SELECT "Rule #4"' by a query rewrite plugin
SELECT * FROM test.t1;
Rule #6
Rule #6
Warnings:
Note	1105	Query 'SELECT * FROM test.t1' rewritten to 'SELECT "Rule #6"' by a query rewrite plugin
SELECT 1 FROM t1;
ERROR 42S02: Table 'db2.t1' doesn't exist
DROP DATABASE db1;
DROP DATABASE db2;
USE test;
DROP TABLE t1;
Warnings:
Warning	1620	Plugin is busy and will be uninstalled on shutdown
# Query rewrite plugin was queued for uninstalling.