~linuxjedi/drizzle/trunk-bug-667053

« back to all changes in this revision

Viewing changes to mysql-test/suite/funcs_1/r/is_statistics.result

  • Committer: brian
  • Date: 2008-06-25 05:29:13 UTC
  • Revision ID: brian@localhost.localdomain-20080625052913-6upwo0jsrl4lnapl
clean slate

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
SHOW TABLES FROM information_schema LIKE 'STATISTICS';
 
2
Tables_in_information_schema (STATISTICS)
 
3
STATISTICS
 
4
#######################################################################
 
5
# Testcase 3.2.1.1: INFORMATION_SCHEMA tables can be queried via SELECT
 
6
#######################################################################
 
7
DROP VIEW      IF EXISTS test.v1;
 
8
DROP PROCEDURE IF EXISTS test.p1;
 
9
DROP FUNCTION  IF EXISTS test.f1;
 
10
CREATE VIEW test.v1 AS     SELECT * FROM information_schema.STATISTICS;
 
11
CREATE PROCEDURE test.p1() SELECT * FROM information_schema.STATISTICS;
 
12
CREATE FUNCTION test.f1() returns BIGINT
 
13
BEGIN
 
14
DECLARE counter BIGINT DEFAULT NULL;
 
15
SELECT COUNT(*) INTO counter FROM information_schema.STATISTICS;
 
16
RETURN counter;
 
17
END//
 
18
# Attention: The printing of the next result sets is disabled.
 
19
SELECT * FROM information_schema.STATISTICS;
 
20
SELECT * FROM test.v1;
 
21
CALL test.p1;
 
22
SELECT test.f1();
 
23
DROP VIEW test.v1;
 
24
DROP PROCEDURE test.p1;
 
25
DROP FUNCTION test.f1;
 
26
#########################################################################
 
27
# Testcase 3.2.14.1: INFORMATION_SCHEMA.STATISTICS layout
 
28
#########################################################################
 
29
DESCRIBE          information_schema.STATISTICS;
 
30
Field   Type    Null    Key     Default Extra
 
31
TABLE_CATALOG   varchar(512)    YES             NULL    
 
32
TABLE_SCHEMA    varchar(64)     NO                      
 
33
TABLE_NAME      varchar(64)     NO                      
 
34
NON_UNIQUE      bigint(1)       NO              0       
 
35
INDEX_SCHEMA    varchar(64)     NO                      
 
36
INDEX_NAME      varchar(64)     NO                      
 
37
SEQ_IN_INDEX    bigint(2)       NO              0       
 
38
COLUMN_NAME     varchar(64)     NO                      
 
39
COLLATION       varchar(1)      YES             NULL    
 
40
CARDINALITY     bigint(21)      YES             NULL    
 
41
SUB_PART        bigint(3)       YES             NULL    
 
42
PACKED  varchar(10)     YES             NULL    
 
43
NULLABLE        varchar(3)      NO                      
 
44
INDEX_TYPE      varchar(16)     NO                      
 
45
COMMENT varchar(16)     YES             NULL    
 
46
INDEX_COMMENT   varchar(1024)   NO                      
 
47
SHOW CREATE TABLE information_schema.STATISTICS;
 
48
Table   Create Table
 
49
STATISTICS      CREATE TEMPORARY TABLE `STATISTICS` (
 
50
  `TABLE_CATALOG` varchar(512) DEFAULT NULL,
 
51
  `TABLE_SCHEMA` varchar(64) NOT NULL DEFAULT '',
 
52
  `TABLE_NAME` varchar(64) NOT NULL DEFAULT '',
 
53
  `NON_UNIQUE` bigint(1) NOT NULL DEFAULT '0',
 
54
  `INDEX_SCHEMA` varchar(64) NOT NULL DEFAULT '',
 
55
  `INDEX_NAME` varchar(64) NOT NULL DEFAULT '',
 
56
  `SEQ_IN_INDEX` bigint(2) NOT NULL DEFAULT '0',
 
57
  `COLUMN_NAME` varchar(64) NOT NULL DEFAULT '',
 
58
  `COLLATION` varchar(1) DEFAULT NULL,
 
59
  `CARDINALITY` bigint(21) DEFAULT NULL,
 
60
  `SUB_PART` bigint(3) DEFAULT NULL,
 
61
  `PACKED` varchar(10) DEFAULT NULL,
 
62
  `NULLABLE` varchar(3) NOT NULL DEFAULT '',
 
63
  `INDEX_TYPE` varchar(16) NOT NULL DEFAULT '',
 
64
  `COMMENT` varchar(16) DEFAULT NULL,
 
65
  `INDEX_COMMENT` varchar(1024) NOT NULL DEFAULT ''
 
66
) ENGINE=MEMORY DEFAULT CHARSET=utf8
 
67
SHOW COLUMNS FROM information_schema.STATISTICS;
 
68
Field   Type    Null    Key     Default Extra
 
69
TABLE_CATALOG   varchar(512)    YES             NULL    
 
70
TABLE_SCHEMA    varchar(64)     NO                      
 
71
TABLE_NAME      varchar(64)     NO                      
 
72
NON_UNIQUE      bigint(1)       NO              0       
 
73
INDEX_SCHEMA    varchar(64)     NO                      
 
74
INDEX_NAME      varchar(64)     NO                      
 
75
SEQ_IN_INDEX    bigint(2)       NO              0       
 
76
COLUMN_NAME     varchar(64)     NO                      
 
77
COLLATION       varchar(1)      YES             NULL    
 
78
CARDINALITY     bigint(21)      YES             NULL    
 
79
SUB_PART        bigint(3)       YES             NULL    
 
80
PACKED  varchar(10)     YES             NULL    
 
81
NULLABLE        varchar(3)      NO                      
 
82
INDEX_TYPE      varchar(16)     NO                      
 
83
COMMENT varchar(16)     YES             NULL    
 
84
INDEX_COMMENT   varchar(1024)   NO                      
 
85
SELECT table_catalog, table_schema, table_name, index_schema, index_name
 
86
FROM information_schema.statistics WHERE table_catalog IS NOT NULL;
 
87
table_catalog   table_schema    table_name      index_schema    index_name
 
88
####################################################################################
 
89
# Testcase 3.2.14.2 + 3.2.14.3: INFORMATION_SCHEMA.STATISTICS accessible information
 
90
####################################################################################
 
91
DROP DATABASE IF EXISTS db_datadict;
 
92
DROP DATABASE IF EXISTS db_datadict_2;
 
93
CREATE DATABASE db_datadict;
 
94
CREATE DATABASE db_datadict_2;
 
95
DROP   USER 'testuser1'@'localhost';
 
96
CREATE USER 'testuser1'@'localhost';
 
97
DROP   USER 'testuser2'@'localhost';
 
98
CREATE USER 'testuser2'@'localhost';
 
99
CREATE TABLE db_datadict.t1
 
100
(f1 INT NOT NULL, PRIMARY KEY(f1), f2 INT, INDEX f2_ind(f2))
 
101
ENGINE = <engine_type>;
 
102
CREATE TABLE db_datadict.t2
 
103
(f1 INT NOT NULL, PRIMARY KEY(f1), f2 INT, INDEX f2_ind(f2))
 
104
ENGINE = <engine_type>;
 
105
CREATE TABLE db_datadict_2.t3
 
106
(f1 INT NOT NULL, f2 INT, f5 DATE,
 
107
PRIMARY KEY(f1), INDEX f2f1_ind(f2,f1), UNIQUE(f5))
 
108
ENGINE = MEMORY;
 
109
CREATE TABLE db_datadict_2.t4
 
110
(f1 INT NOT NULL, PRIMARY KEY(f1), f2 INT, INDEX f2_ind(f2))
 
111
ENGINE = MEMORY;
 
112
SELECT * FROM information_schema.statistics
 
113
WHERE table_schema LIKE 'db_datadict%'
 
114
ORDER BY table_schema,table_name,index_name,seq_in_index,column_name;
 
115
TABLE_CATALOG   TABLE_SCHEMA    TABLE_NAME      NON_UNIQUE      INDEX_SCHEMA    INDEX_NAME      SEQ_IN_INDEX    COLUMN_NAME     COLLATION       CARDINALITY     SUB_PART        PACKED  NULLABLE        INDEX_TYPE      COMMENT INDEX_COMMENT
 
116
NULL    db_datadict     t1      1       db_datadict     f2_ind  1       f2      NULL    0       NULL    NULL    YES     HASH            
 
117
NULL    db_datadict     t1      0       db_datadict     PRIMARY 1       f1      NULL    0       NULL    NULL            HASH            
 
118
NULL    db_datadict     t2      1       db_datadict     f2_ind  1       f2      NULL    0       NULL    NULL    YES     HASH            
 
119
NULL    db_datadict     t2      0       db_datadict     PRIMARY 1       f1      NULL    0       NULL    NULL            HASH            
 
120
NULL    db_datadict_2   t3      1       db_datadict_2   f2f1_ind        1       f2      NULL    NULL    NULL    NULL    YES     HASH            
 
121
NULL    db_datadict_2   t3      1       db_datadict_2   f2f1_ind        2       f1      NULL    0       NULL    NULL            HASH            
 
122
NULL    db_datadict_2   t3      0       db_datadict_2   f5      1       f5      NULL    0       NULL    NULL    YES     HASH            
 
123
NULL    db_datadict_2   t3      0       db_datadict_2   PRIMARY 1       f1      NULL    0       NULL    NULL            HASH            
 
124
NULL    db_datadict_2   t4      1       db_datadict_2   f2_ind  1       f2      NULL    0       NULL    NULL    YES     HASH            
 
125
NULL    db_datadict_2   t4      0       db_datadict_2   PRIMARY 1       f1      NULL    0       NULL    NULL            HASH            
 
126
SHOW GRANTS FOR 'testuser1'@'localhost';
 
127
Grants for testuser1@localhost
 
128
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
 
129
SHOW GRANTS FOR 'testuser2'@'localhost';
 
130
Grants for testuser2@localhost
 
131
GRANT USAGE ON *.* TO 'testuser2'@'localhost'
 
132
# Establish connection testuser1 (user=testuser1)
 
133
SELECT * FROM information_schema.statistics
 
134
WHERE table_schema LIKE 'db_datadict%'
 
135
ORDER BY table_schema,table_name,index_name,seq_in_index,column_name;
 
136
TABLE_CATALOG   TABLE_SCHEMA    TABLE_NAME      NON_UNIQUE      INDEX_SCHEMA    INDEX_NAME      SEQ_IN_INDEX    COLUMN_NAME     COLLATION       CARDINALITY     SUB_PART        PACKED  NULLABLE        INDEX_TYPE      COMMENT INDEX_COMMENT
 
137
SHOW GRANTS FOR 'testuser1'@'localhost';
 
138
Grants for testuser1@localhost
 
139
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
 
140
SHOW GRANTS FOR 'testuser2'@'localhost';
 
141
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'mysql'
 
142
# Establish connection testuser2 (user=testuser2)
 
143
SELECT * FROM information_schema.statistics
 
144
WHERE table_schema LIKE 'db_datadict%'
 
145
ORDER BY table_schema,table_name,index_name,seq_in_index,column_name;
 
146
TABLE_CATALOG   TABLE_SCHEMA    TABLE_NAME      NON_UNIQUE      INDEX_SCHEMA    INDEX_NAME      SEQ_IN_INDEX    COLUMN_NAME     COLLATION       CARDINALITY     SUB_PART        PACKED  NULLABLE        INDEX_TYPE      COMMENT INDEX_COMMENT
 
147
SHOW GRANTS FOR 'testuser1'@'localhost';
 
148
ERROR 42000: Access denied for user 'testuser2'@'localhost' to database 'mysql'
 
149
SHOW GRANTS FOR 'testuser2'@'localhost';
 
150
Grants for testuser2@localhost
 
151
GRANT USAGE ON *.* TO 'testuser2'@'localhost'
 
152
# Switch to connection default
 
153
GRANT SELECT ON db_datadict.t1 TO 'testuser1'@'localhost' WITH GRANT OPTION;
 
154
GRANT SELECT(f1,f5) ON db_datadict_2.t3 TO 'testuser1'@'localhost';
 
155
SELECT * FROM information_schema.statistics
 
156
WHERE table_schema LIKE 'db_datadict%'
 
157
ORDER BY table_schema,table_name,index_name,seq_in_index,column_name;
 
158
TABLE_CATALOG   TABLE_SCHEMA    TABLE_NAME      NON_UNIQUE      INDEX_SCHEMA    INDEX_NAME      SEQ_IN_INDEX    COLUMN_NAME     COLLATION       CARDINALITY     SUB_PART        PACKED  NULLABLE        INDEX_TYPE      COMMENT INDEX_COMMENT
 
159
NULL    db_datadict     t1      1       db_datadict     f2_ind  1       f2      NULL    0       NULL    NULL    YES     HASH            
 
160
NULL    db_datadict     t1      0       db_datadict     PRIMARY 1       f1      NULL    0       NULL    NULL            HASH            
 
161
NULL    db_datadict     t2      1       db_datadict     f2_ind  1       f2      NULL    0       NULL    NULL    YES     HASH            
 
162
NULL    db_datadict     t2      0       db_datadict     PRIMARY 1       f1      NULL    0       NULL    NULL            HASH            
 
163
NULL    db_datadict_2   t3      1       db_datadict_2   f2f1_ind        1       f2      NULL    NULL    NULL    NULL    YES     HASH            
 
164
NULL    db_datadict_2   t3      1       db_datadict_2   f2f1_ind        2       f1      NULL    0       NULL    NULL            HASH            
 
165
NULL    db_datadict_2   t3      0       db_datadict_2   f5      1       f5      NULL    0       NULL    NULL    YES     HASH            
 
166
NULL    db_datadict_2   t3      0       db_datadict_2   PRIMARY 1       f1      NULL    0       NULL    NULL            HASH            
 
167
NULL    db_datadict_2   t4      1       db_datadict_2   f2_ind  1       f2      NULL    0       NULL    NULL    YES     HASH            
 
168
NULL    db_datadict_2   t4      0       db_datadict_2   PRIMARY 1       f1      NULL    0       NULL    NULL            HASH            
 
169
SHOW GRANTS FOR 'testuser1'@'localhost';
 
170
Grants for testuser1@localhost
 
171
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
 
172
GRANT SELECT (f5, f1) ON `db_datadict_2`.`t3` TO 'testuser1'@'localhost'
 
173
GRANT SELECT ON `db_datadict`.`t1` TO 'testuser1'@'localhost' WITH GRANT OPTION
 
174
SHOW GRANTS FOR 'testuser2'@'localhost';
 
175
Grants for testuser2@localhost
 
176
GRANT USAGE ON *.* TO 'testuser2'@'localhost'
 
177
# Switch to connection testuser1
 
178
SELECT * FROM information_schema.statistics
 
179
WHERE table_schema LIKE 'db_datadict%'
 
180
ORDER BY table_schema,table_name,index_name,seq_in_index,column_name;
 
181
TABLE_CATALOG   TABLE_SCHEMA    TABLE_NAME      NON_UNIQUE      INDEX_SCHEMA    INDEX_NAME      SEQ_IN_INDEX    COLUMN_NAME     COLLATION       CARDINALITY     SUB_PART        PACKED  NULLABLE        INDEX_TYPE      COMMENT INDEX_COMMENT
 
182
NULL    db_datadict     t1      1       db_datadict     f2_ind  1       f2      NULL    0       NULL    NULL    YES     HASH            
 
183
NULL    db_datadict     t1      0       db_datadict     PRIMARY 1       f1      NULL    0       NULL    NULL            HASH            
 
184
NULL    db_datadict_2   t3      1       db_datadict_2   f2f1_ind        1       f2      NULL    NULL    NULL    NULL    YES     HASH            
 
185
NULL    db_datadict_2   t3      1       db_datadict_2   f2f1_ind        2       f1      NULL    0       NULL    NULL            HASH            
 
186
NULL    db_datadict_2   t3      0       db_datadict_2   f5      1       f5      NULL    0       NULL    NULL    YES     HASH            
 
187
NULL    db_datadict_2   t3      0       db_datadict_2   PRIMARY 1       f1      NULL    0       NULL    NULL            HASH            
 
188
SHOW GRANTS FOR 'testuser1'@'localhost';
 
189
Grants for testuser1@localhost
 
190
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
 
191
GRANT SELECT (f5, f1) ON `db_datadict_2`.`t3` TO 'testuser1'@'localhost'
 
192
GRANT SELECT ON `db_datadict`.`t1` TO 'testuser1'@'localhost' WITH GRANT OPTION
 
193
SHOW GRANTS FOR 'testuser2'@'localhost';
 
194
ERROR 42000: Access denied for user 'testuser1'@'localhost' to database 'mysql'
 
195
# Switch to connection testuser2
 
196
SELECT * FROM information_schema.statistics
 
197
WHERE table_schema LIKE 'db_datadict%'
 
198
ORDER BY table_schema,table_name,index_name,seq_in_index,column_name;
 
199
TABLE_CATALOG   TABLE_SCHEMA    TABLE_NAME      NON_UNIQUE      INDEX_SCHEMA    INDEX_NAME      SEQ_IN_INDEX    COLUMN_NAME     COLLATION       CARDINALITY     SUB_PART        PACKED  NULLABLE        INDEX_TYPE      COMMENT INDEX_COMMENT
 
200
SHOW GRANTS FOR 'testuser1'@'localhost';
 
201
ERROR 42000: Access denied for user 'testuser2'@'localhost' to database 'mysql'
 
202
SHOW GRANTS FOR 'testuser2'@'localhost';
 
203
Grants for testuser2@localhost
 
204
GRANT USAGE ON *.* TO 'testuser2'@'localhost'
 
205
# Switch to connection default
 
206
REVOKE SELECT,GRANT OPTION ON db_datadict.t1 FROM 'testuser1'@'localhost';
 
207
SHOW GRANTS FOR 'testuser1'@'localhost';
 
208
Grants for testuser1@localhost
 
209
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
 
210
GRANT SELECT (f5, f1) ON `db_datadict_2`.`t3` TO 'testuser1'@'localhost'
 
211
# Switch to connection testuser1
 
212
SELECT * FROM information_schema.statistics
 
213
WHERE table_schema LIKE 'db_datadict%'
 
214
ORDER BY table_schema,table_name,index_name,seq_in_index,column_name;
 
215
TABLE_CATALOG   TABLE_SCHEMA    TABLE_NAME      NON_UNIQUE      INDEX_SCHEMA    INDEX_NAME      SEQ_IN_INDEX    COLUMN_NAME     COLLATION       CARDINALITY     SUB_PART        PACKED  NULLABLE        INDEX_TYPE      COMMENT INDEX_COMMENT
 
216
NULL    db_datadict_2   t3      1       db_datadict_2   f2f1_ind        1       f2      NULL    NULL    NULL    NULL    YES     HASH            
 
217
NULL    db_datadict_2   t3      1       db_datadict_2   f2f1_ind        2       f1      NULL    0       NULL    NULL            HASH            
 
218
NULL    db_datadict_2   t3      0       db_datadict_2   f5      1       f5      NULL    0       NULL    NULL    YES     HASH            
 
219
NULL    db_datadict_2   t3      0       db_datadict_2   PRIMARY 1       f1      NULL    0       NULL    NULL            HASH            
 
220
SHOW GRANTS FOR 'testuser1'@'localhost';
 
221
Grants for testuser1@localhost
 
222
GRANT USAGE ON *.* TO 'testuser1'@'localhost'
 
223
GRANT SELECT (f5, f1) ON `db_datadict_2`.`t3` TO 'testuser1'@'localhost'
 
224
# Switch to connection default and close connections testuser1, testuser2
 
225
DROP USER 'testuser1'@'localhost';
 
226
DROP USER 'testuser2'@'localhost';
 
227
DROP DATABASE db_datadict;
 
228
DROP DATABASE db_datadict_2;
 
229
#########################################################################
 
230
# 3.2.1.13+3.2.1.14+3.2.1.15: INFORMATION_SCHEMA.STATISTICS modifications
 
231
#########################################################################
 
232
DROP TABLE IF EXISTS test.t1_my_table;
 
233
DROP DATABASE IF EXISTS db_datadict;
 
234
CREATE DATABASE db_datadict;
 
235
CREATE TABLE test.t1_1 (f1 BIGINT,
 
236
f2 TEXT, f2x TEXT, f3 CHAR(10), f3x CHAR(10), f4 BIGINT, f4x BIGINT,
 
237
f5 POINT, f5x POINT NOT NULL)
 
238
DEFAULT CHARACTER SET latin1 COLLATE latin1_swedish_ci
 
239
ENGINE = <other_engine_type>;
 
240
CREATE TABLE test.t1_2 (f1 BIGINT, f2 BIGINT)
 
241
ENGINE = <engine_type>;
 
242
SELECT table_name FROM information_schema.statistics
 
243
WHERE table_name LIKE 't1_%';
 
244
table_name
 
245
ALTER TABLE test.t1_1 ADD PRIMARY KEY (f1,f3);
 
246
SELECT * FROM information_schema.statistics
 
247
WHERE table_name LIKE 't1_%'
 
248
ORDER BY table_schema,table_name,index_name,seq_in_index,column_name;
 
249
TABLE_CATALOG   TABLE_SCHEMA    TABLE_NAME      NON_UNIQUE      INDEX_SCHEMA    INDEX_NAME      SEQ_IN_INDEX    COLUMN_NAME     COLLATION       CARDINALITY     SUB_PART        PACKED  NULLABLE        INDEX_TYPE      COMMENT INDEX_COMMENT
 
250
NULL    test    t1_1    0       test    PRIMARY 1       f1      A       NULL    NULL    NULL            BTREE           
 
251
NULL    test    t1_1    0       test    PRIMARY 2       f3      A       0       NULL    NULL            BTREE           
 
252
ALTER TABLE test.t1_1 DROP PRIMARY KEY;
 
253
SELECT table_name FROM information_schema.statistics
 
254
WHERE table_name LIKE 't1_%';
 
255
table_name
 
256
ALTER TABLE test.t1_1 ADD PRIMARY KEY (f1);
 
257
SELECT * FROM information_schema.statistics
 
258
WHERE table_name LIKE 't1_%';
 
259
TABLE_CATALOG   TABLE_SCHEMA    TABLE_NAME      NON_UNIQUE      INDEX_SCHEMA    INDEX_NAME      SEQ_IN_INDEX    COLUMN_NAME     COLLATION       CARDINALITY     SUB_PART        PACKED  NULLABLE        INDEX_TYPE      COMMENT INDEX_COMMENT
 
260
NULL    test    t1_1    0       test    PRIMARY 1       f1      A       0       NULL    NULL            BTREE           
 
261
ALTER TABLE test.t1_1 ADD INDEX (f4);
 
262
CREATE        INDEX f3_f1     ON test.t1_1 (f3,f1);
 
263
CREATE UNIQUE INDEX f4x_uni   ON test.t1_1 (f4x);
 
264
CREATE        INDEX f2_hash USING HASH ON test.t1_2 (f2);
 
265
CREATE        INDEX f1_idx    ON test.t1_2 (f1) COMMENT = 'COMMENT';
 
266
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 '= 'COMMENT'' at line 1
 
267
CREATE        INDEX not_null  ON test.t1_1 (f3x);
 
268
CREATE        INDEX f2_prefix ON test.t1_1 (f2(20));
 
269
SELECT * FROM information_schema.statistics
 
270
WHERE table_name LIKE 't1_%' AND index_name <> 'PRIMARY'
 
271
ORDER BY table_schema,table_name,index_name,seq_in_index,column_name;
 
272
TABLE_CATALOG   TABLE_SCHEMA    TABLE_NAME      NON_UNIQUE      INDEX_SCHEMA    INDEX_NAME      SEQ_IN_INDEX    COLUMN_NAME     COLLATION       CARDINALITY     SUB_PART        PACKED  NULLABLE        INDEX_TYPE      COMMENT INDEX_COMMENT
 
273
NULL    test    t1_1    1       test    f2_prefix       1       f2      A       NULL    20      NULL    YES     BTREE           
 
274
NULL    test    t1_1    1       test    f3_f1   1       f3      A       NULL    NULL    NULL            BTREE           
 
275
NULL    test    t1_1    1       test    f3_f1   2       f1      A       NULL    NULL    NULL            BTREE           
 
276
NULL    test    t1_1    1       test    f4      1       f4      A       NULL    NULL    NULL    YES     BTREE           
 
277
NULL    test    t1_1    0       test    f4x_uni 1       f4x     A       NULL    NULL    NULL    YES     BTREE           
 
278
NULL    test    t1_1    1       test    not_null        1       f3x     A       NULL    NULL    NULL    YES     BTREE           
 
279
NULL    test    t1_2    1       test    f2_hash 1       f2      NULL    0       NULL    NULL    YES     HASH            
 
280
DROP TABLE test.t1_2;
 
281
SELECT DISTINCT table_name FROM information_schema.statistics
 
282
WHERE table_name = 't1_1';
 
283
table_name
 
284
t1_1
 
285
RENAME TABLE test.t1_1 TO test.t1_1x;
 
286
SELECT DISTINCT table_name FROM information_schema.statistics
 
287
WHERE table_name = 't1_1x';
 
288
table_name
 
289
t1_1x
 
290
SELECT DISTINCT table_schema,table_name FROM information_schema.statistics
 
291
WHERE table_name LIKE 't1_1%';
 
292
table_schema    table_name
 
293
test    t1_1x
 
294
RENAME TABLE test.t1_1x TO db_datadict.t1_1x;
 
295
SELECT DISTINCT table_schema,table_name FROM information_schema.statistics
 
296
WHERE table_name LIKE 't1_1%';
 
297
table_schema    table_name
 
298
db_datadict     t1_1x
 
299
SELECT DISTINCT table_name FROM information_schema.statistics
 
300
WHERE table_name = 't1_1x';
 
301
table_name
 
302
t1_1x
 
303
DROP TABLE db_datadict.t1_1x;
 
304
SELECT DISTINCT table_name FROM information_schema.statistics
 
305
WHERE table_name = 't1_1x';
 
306
table_name
 
307
CREATE TEMPORARY TABLE test.t1_1x (PRIMARY KEY(f1,f2))
 
308
ENGINE = <engine_type>
 
309
AS SELECT 1 AS f1, 2 AS f2;
 
310
SELECT * FROM information_schema.statistics
 
311
WHERE table_name = 't1_1x';
 
312
DROP TEMPORARY TABLE test.t1_1x;
 
313
CREATE TABLE db_datadict.t1_1x (PRIMARY KEY(f1))
 
314
ENGINE = <engine_type>
 
315
AS SELECT 1 AS f1, 2 AS f2;
 
316
SELECT table_name FROM information_schema.statistics
 
317
WHERE table_name = 't1_1x';
 
318
table_name
 
319
t1_1x
 
320
DROP DATABASE db_datadict;
 
321
SELECT table_name FROM information_schema.statistics
 
322
WHERE table_name = 't1_1x';
 
323
table_name
 
324
########################################################################
 
325
# Testcases 3.2.1.3-3.2.1.5 + 3.2.1.8-3.2.1.12: INSERT/UPDATE/DELETE and
 
326
#           DDL on INFORMATION_SCHEMA tables are not supported
 
327
########################################################################
 
328
DROP DATABASE IF EXISTS db_datadict;
 
329
CREATE DATABASE db_datadict;
 
330
CREATE TABLE db_datadict.t1 (f1 BIGINT)
 
331
ENGINE = <engine_type>;
 
332
INSERT INTO information_schema.statistics
 
333
SELECT * FROM information_schema.statistics;
 
334
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
 
335
UPDATE information_schema.statistics SET table_schema = 'test'
 
336
WHERE table_name = 't1';
 
337
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
 
338
DELETE FROM information_schema.statistics WHERE table_name = 't1';
 
339
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
 
340
TRUNCATE information_schema.statistics;
 
341
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
 
342
CREATE INDEX my_idx_on_statistics
 
343
ON information_schema.statistics(table_schema);
 
344
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
 
345
ALTER TABLE information_schema.statistics DROP PRIMARY KEY;
 
346
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
 
347
ALTER TABLE information_schema.statistics ADD f1 INT;
 
348
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
 
349
DROP TABLE information_schema.statistics;
 
350
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
 
351
ALTER TABLE information_schema.statistics RENAME db_datadict.statistics;
 
352
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
 
353
ALTER TABLE information_schema.statistics RENAME information_schema.xstatistics;
 
354
ERROR 42000: Access denied for user 'root'@'localhost' to database 'information_schema'
 
355
DROP DATABASE db_datadict;