22
17
create table t5 (id int auto_increment primary key);
23
18
insert into t5 values (10);
25
select table_name from information_schema.TABLES
20
select table_name from data_dictionary.tables
26
21
where table_schema = "mysqltest" and table_name like "t%";
28
select * from information_schema.STATISTICS where TABLE_SCHEMA = "mysqltest";
23
select * from data_dictionary.indexes where TABLE_SCHEMA = "mysqltest";
30
25
show tables like 't%';
31
--replace_column 8 # 12 # 13 #
33
show full columns from t3 like "a%";
34
select * from information_schema.COLUMNS where table_name="t1"
26
--replace_column 1 # 6 # 7 # 8 # 9 # 10 #
28
show columns from t3 like "a%";
29
select * from data_dictionary.columns where table_name="t1"
35
30
and column_name= "a";
37
32
connect (user3,localhost,mysqltest_2,,);
39
select table_name, column_name, privileges from information_schema.columns
34
select table_name, column_name from data_dictionary.columns
40
35
where table_schema = 'mysqltest' and table_name = 't1';
41
36
show columns from mysqltest.t1;
42
37
connect (user4,localhost,mysqltest_3,,mysqltest);
46
41
drop tables mysqltest.t4, mysqltest.t1, t2, t3, t5;
47
42
drop database mysqltest;
49
# Test for information_schema.CHARACTER_SETS &
52
select * from information_schema.CHARACTER_SETS
53
where CHARACTER_SET_NAME like 'latin1%';
55
# Test for information_schema.COLLATIONS &
59
select * from information_schema.COLLATIONS
60
where COLLATION_NAME like 'latin1%';
62
select * from information_schema.COLLATION_CHARACTER_SET_APPLICABILITY
63
where COLLATION_NAME like 'latin1%';
66
# Bug#7213: information_schema: redundant non-standard TABLE_NAMES table
69
select * from information_schema.table_names;
72
45
# Bug#2719 information_schema: errors in "columns"
74
select column_type from information_schema.columns
75
where table_schema="information_schema" and table_name="COLUMNS" and
47
select column_type from data_dictionary.columns
48
where table_schema="data_dictionary" and table_name="COLUMNS" and
76
49
(column_name="character_set_name" or column_name="collation_name");
79
52
# Bug#2718 information_schema: errors in "tables"
81
select TABLE_ROWS from information_schema.tables where
82
table_schema="information_schema" and table_name="COLUMNS";
83
select table_type from information_schema.tables
55
select count(*) from data_dictionary.tables where
56
table_schema="data_dictionary" and table_name="COLUMNS";
59
select count(*) from data_dictionary.tables
84
60
where table_schema="mysql" and table_name="user";
87
63
# Bug #7215 information_schema: columns are longtext instead of varchar
88
64
# Bug #7217 information_schema: columns are varbinary() instead of timestamp
90
select table_schema,table_name, column_name from
91
information_schema.columns
92
where data_type = 'longtext';
93
select table_name, column_name, data_type from information_schema.columns
94
where data_type = 'datetime';
66
select table_schema, table_name, column_name from data_dictionary.columns where data_type = 'longtext';
67
select table_name, column_name, data_type from data_dictionary.columns where data_type = 'datetime';
97
# Bug #8164 subquery with INFORMATION_SCHEMA.COLUMNS, 100 % CPU
70
# Bug #8164 subquery with data_dictionary.COLUMNS, 100 % CPU
99
SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES A
72
SELECT COUNT(*) FROM data_dictionary.tables A
101
(SELECT * FROM INFORMATION_SCHEMA.COLUMNS B
74
(SELECT * FROM data_dictionary.columns B
102
75
WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA
103
76
AND A.TABLE_NAME = B.TABLE_NAME);
189
137
create table t1(id int);
190
138
insert into t1(id) values (1);
191
139
select 1 from (select 1 from test.t1) a;
192
use information_schema;
193
141
select 1 from (select 1 from test.t1) a;
197
# Bug #14387 SHOW COLUMNS doesn't work on temporary tables
198
# Bug #15224 SHOW INDEX from temporary table doesn't work
199
# Bug #12770 DESC cannot display the info. about temporary table
201
create temporary table t1(f1 int, index(f1));
202
show columns from t1;
204
show indexes from t1;
208
146
# Bug#14271 I_S: columns has no size for (var)binary columns
210
148
create table t1(f1 varbinary(32), f2 varbinary(64));
211
149
select character_maximum_length, character_octet_length
212
from information_schema.columns where table_name='t1';
150
from data_dictionary.columns where table_name='t1';
216
# Bug#15307 GROUP_CONCAT() with ORDER BY returns empty set on information_schema
154
## Bug#15307 GROUP_CONCAT() with ORDER BY returns empty set on information_schema
218
156
select column_type, group_concat(table_schema, '.', table_name), count(*) as num
219
from information_schema.columns where
220
table_schema='information_schema' and
157
from data_dictionary.columns where
158
table_schema='data_dictionary' and
221
159
(column_type = 'varchar(7)' or column_type = 'varchar(20)'
222
160
or column_type = 'varchar(27)')
223
161
group by column_type order by column_type, num;
247
185
SELECT t.table_name, c1.column_name
248
FROM information_schema.tables t
186
FROM data_dictionary.tables t
250
information_schema.columns c1
188
data_dictionary.columns c1
251
189
ON t.table_schema = c1.table_schema AND
252
190
t.table_name = c1.table_name
253
WHERE t.table_schema = 'information_schema' AND
191
WHERE t.table_schema = 'data_dictionary' AND
254
192
c1.ordinal_position =
255
193
( SELECT COALESCE(MIN(c2.ordinal_position),1)
256
FROM information_schema.columns c2
194
FROM data_dictionary.columns c2
257
195
WHERE c2.table_schema = t.table_schema AND
258
196
c2.table_name = t.table_name AND
259
197
c2.column_name LIKE '%SCHEMA%'
261
199
AND t.table_name NOT LIKE 'falcon%'
262
AND t.plugin_name IS NULL;
200
ORDER BY t.table_name, c1.column_name;
263
202
SELECT t.table_name, c1.column_name
264
FROM information_schema.tables t
203
FROM data_dictionary.tables t
266
information_schema.columns c1
205
data_dictionary.columns c1
267
206
ON t.table_schema = c1.table_schema AND
268
207
t.table_name = c1.table_name
269
WHERE t.table_schema = 'information_schema' AND
208
WHERE t.table_schema = 'data_dictionary' AND
270
209
c1.ordinal_position =
271
210
( SELECT COALESCE(MIN(c2.ordinal_position),1)
272
FROM information_schema.columns c2
273
WHERE c2.table_schema = 'information_schema' AND
211
FROM data_dictionary.columns c2
212
WHERE c2.table_schema = 'data_dictionary' AND
274
213
c2.table_name = t.table_name AND
275
214
c2.column_name LIKE '%SCHEMA%'
277
216
AND t.table_name NOT LIKE 'falcon%'
278
AND t.plugin_name IS NULL;
217
ORDER BY t.table_name, c1.column_name;
281
220
# Bug#21231: query with a simple non-correlated subquery over
282
221
# INFORMARTION_SCHEMA.TABLES
285
SELECT MAX(table_name) FROM information_schema.tables;
286
SELECT table_name from information_schema.tables
224
SELECT MAX(table_name) FROM data_dictionary.tables;
225
SELECT table_name from data_dictionary.tables
287
226
WHERE table_name=(SELECT MAX(table_name)
288
FROM information_schema.tables);
227
FROM data_dictionary.tables)
290
230
# Bug#23299 Some queries against INFORMATION_SCHEMA with subqueries fail
292
232
create table t1 (f1 int);
293
233
create table t2 (f1 int, f2 int);
295
select table_name from information_schema.tables
296
where table_schema = 'test' and table_name not in
297
(select table_name from information_schema.columns
298
where table_schema = 'test' and column_name = 'f3');
235
#select table_name from data_dictionary.tables
236
#where table_schema = 'test' and table_name not in
237
#(select table_name from data_dictionary.columns
238
# where table_schema = 'test' and column_name = 'f3')
239
#ORDER BY table_name;
299
241
drop table t1,t2;
303
245
# Bug#24630 Subselect query crashes mysqld
305
select 1 as f1 from information_schema.tables where "CHARACTER_SETS"=
306
(select cast(table_name as char) from information_schema.tables
247
select 1 as f1 from data_dictionary.tables where "CHARACTER_SETS"=
248
(select cast(table_name as char) from data_dictionary.tables
307
249
order by table_name limit 1) limit 1;
309
251
select t.table_name, group_concat(t.table_schema, '.', t.table_name),
311
from information_schema.tables t
312
inner join information_schema.columns c1
253
from data_dictionary.tables t
254
inner join data_dictionary.columns c1
313
255
on t.table_schema = c1.table_schema AND t.table_name = c1.table_name
314
where t.table_schema = 'information_schema' AND
256
where t.table_schema = 'data_dictionary' AND
315
257
t.table_name not like 'falcon%' AND
316
t.plugin_name IS NULL AND
317
258
c1.ordinal_position =
318
259
(select isnull(c2.column_type) -
319
260
isnull(group_concat(c2.table_schema, '.', c2.table_name)) +
321
from information_schema.columns c2 where
322
c2.table_schema='information_schema' and
262
from data_dictionary.columns c2 where
263
c2.table_schema='data_dictionary' and
323
264
(c2.column_type = 'varchar(7)' or c2.column_type = 'varchar(20)')
324
265
group by c2.column_type order by num limit 1)
325
266
group by t.table_name order by num1, t.table_name;
345
286
f7 datetime not null,
346
287
f8 datetime default '2006-01-01'
348
select column_default from information_schema.columns where table_name= 't1';
289
#select column_default from data_dictionary.columns where table_name= 't1' ORDER BY column_default;
349
290
show columns from t1;
353
# Bug#30079 A check for "hidden" I_S tables is flawed
356
show fields from information_schema.table_names;
358
show keys from information_schema.table_names;
360
293
SET max_heap_table_size = DEFAULT;
363
296
--echo End of 5.0 tests.
366
# Bug#30795 Query on INFORMATION_SCHEMA.SCHEMATA, wrong result
299
# Bug#30795 Query on data_dictionary.schemas, wrong result
368
SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA
369
WHERE SCHEMA_NAME ='information_schema';
301
SELECT SCHEMA_NAME FROM data_dictionary.schemas
302
WHERE SCHEMA_NAME ='data_dictionary';
372
305
# Bug#31381 Error in retrieving Data from INFORMATION_SCHEMA
374
SELECT TABLE_COLLATION FROM INFORMATION_SCHEMA.TABLES
307
SELECT TABLE_COLLATION FROM data_dictionary.tables
375
308
WHERE TABLE_SCHEMA='mysql' and TABLE_NAME= 'db';
378
# Bug#31633 Information schema = NULL queries crash the server
380
select * from information_schema.columns where table_schema = NULL;
381
select * from `information_schema`.`COLUMNS` where `TABLE_NAME` = NULL;
382
select * from `information_schema`.`KEY_COLUMN_USAGE` where `TABLE_SCHEMA` = NULL;
383
select * from `information_schema`.`KEY_COLUMN_USAGE` where `TABLE_NAME` = NULL;
384
select * from `information_schema`.`REFERENTIAL_CONSTRAINTS` where `CONSTRAINT_SCHEMA` = NULL;
385
select * from `information_schema`.`REFERENTIAL_CONSTRAINTS` where `TABLE_NAME` = NULL;
386
select * from information_schema.schemata where schema_name = NULL;
387
select * from `information_schema`.`STATISTICS` where `TABLE_SCHEMA` = NULL;
388
select * from `information_schema`.`STATISTICS` where `TABLE_NAME` = NULL;
389
select * from information_schema.tables where table_schema = NULL;
390
select * from information_schema.tables where table_catalog = NULL;
391
select * from information_schema.tables where table_name = NULL;
392
select * from `information_schema`.`TABLE_CONSTRAINTS` where `TABLE_SCHEMA` = NULL;
393
select * from `information_schema`.`TABLE_CONSTRAINTS` where `TABLE_NAME` = NULL;
396
311
--echo # Test that the query is visible to self and others.
399
SELECT info FROM information_schema.processlist WHERE id = CONNECTION_ID();
402
# test that SHOW PROCESSLIST works correctly
404
--replace_column 1 # 2 # 3 # 6 # 7 #
314
SELECT info FROM data_dictionary.processlist WHERE id = CONNECTION_ID();
408
317
# do a query on the PROCESSLIST table in I_S to ensure it works correctly
410
319
SELECT info, command, db
411
FROM information_schema.processlist
320
FROM data_dictionary.processlist
412
321
WHERE id = CONNECTION_ID();
415
# do a query on the CHARACTER_SET table in I_S
418
FROM information_schema.character_sets
419
ORDER BY character_set_name;
422
# perform a query on the COLLATIONS table
425
FROM information_schema.collations
426
ORDER BY collation_name;
429
# perform a query on COLLATION_CHARACTER_SET_APPLICABILITY
432
FROM information_schema.collation_character_set_applicability
433
ORDER BY collation_name;
436
# perform a query on COLUMNS
438
SELECT table_name, column_name
439
FROM information_schema.columns
441
(SELECT table_name FROM information_schema.tables
442
WHERE plugin_name IS NULL)
446
# perform a query on KEY_COLUMN_USAGE
449
FROM information_schema.key_column_usage;
452
# perform a query on REFERENTIAL_CONSTRAINTS
455
FROM information_schema.referential_constraints;
458
# query the SCHEMATA table
460
SELECT catalog_name, schema_name
461
FROM information_schema.schemata
462
ORDER BY schema_name;
465
# Query the STATUS and VARIABLES related
466
# I_S related tables.
468
--replace_column 1 # 2 #
470
FROM information_schema.session_status
471
ORDER BY variable_name;
473
--replace_column 1 # 2 #
476
#--replace_column 1 # 2 #
478
#FROM information_schema.session_variables
479
#ORDER BY variable_name;
481
#--replace_column 1 # 2 #
484
--replace_column 1 # 2 #
486
FROM information_schema.global_status
487
ORDER BY variable_name;
489
#--replace_column 1 # 2 #
491
#FROM information_schema.global_variables
492
#ORDER BY variable_name;
495
# query TABLE_CONSTRAINTS table
498
FROM information_schema.table_constraints;
503
SELECT table_schema, table_name
504
FROM information_schema.tables
505
WHERE plugin_name IS NULL
509
# do a query on the PLUGINS table in I_S to ensure it works correctly
510
# how do we test for this if the contents of this table can change
511
# depend on what plugins are configured for use?
326
#SELECT table_schema, table_name
327
#FROM data_dictionary.tables
328
#WHERE table_schema="data_dictionary"
329
#ORDER BY table_name;