22
23
create table t5 (id int auto_increment primary key);
23
24
insert into t5 values (10);
25
select table_name from information_schema.TABLES
26
select table_name from data_dictionary.tables
26
27
where table_schema = "mysqltest" and table_name like "t%";
28
select * from information_schema.STATISTICS where TABLE_SCHEMA = "mysqltest";
29
select * from information_schema.old_STATISTICS where TABLE_SCHEMA = "mysqltest";
30
31
show tables like 't%';
31
32
--replace_column 8 # 12 # 13 #
32
33
#show table status;
33
show full columns from t3 like "a%";
34
select * from information_schema.COLUMNS where table_name="t1"
34
show columns from t3 like "a%";
35
select * from information_schema.old_COLUMNS where table_name="t1"
35
36
and column_name= "a";
37
38
connect (user3,localhost,mysqltest_2,,);
39
select table_name, column_name, privileges from information_schema.columns
40
select table_name, column_name, privileges from information_schema.old_columns
40
41
where table_schema = 'mysqltest' and table_name = 't1';
41
42
show columns from mysqltest.t1;
42
43
connect (user4,localhost,mysqltest_3,,mysqltest);
46
47
drop tables mysqltest.t4, mysqltest.t1, t2, t3, t5;
47
48
drop database mysqltest;
49
# Test for information_schema.CHARACTER_SETS &
52
select * from information_schema.CHARACTER_SETS
50
# Test for information_schema.old_CHARACTER_SETS &
51
select * from data_dictionary.CHARACTER_SETS
53
52
where CHARACTER_SET_NAME like 'latin1%';
55
# Test for information_schema.COLLATIONS &
54
# Test for information_schema.old_COLLATIONS &
58
56
--replace_column 5 #
59
select * from information_schema.COLLATIONS
60
where COLLATION_NAME like 'latin1%';
62
select * from information_schema.COLLATION_CHARACTER_SET_APPLICABILITY
57
select * from data_dictionary.COLLATIONS
63
58
where COLLATION_NAME like 'latin1%';
66
61
# Bug#7213: information_schema: redundant non-standard TABLE_NAMES table
69
select * from information_schema.table_names;
64
select * from information_schema.old_table_names;
72
67
# Bug#2719 information_schema: errors in "columns"
74
select column_type from information_schema.columns
69
select column_type from information_schema.old_columns
75
70
where table_schema="information_schema" and table_name="COLUMNS" and
76
71
(column_name="character_set_name" or column_name="collation_name");
79
74
# Bug#2718 information_schema: errors in "tables"
81
select TABLE_ROWS from information_schema.tables where
77
select count(*) from data_dictionary.tables where
82
78
table_schema="information_schema" and table_name="COLUMNS";
83
select table_type from information_schema.tables
81
select count(*) from data_dictionary.tables
84
82
where table_schema="mysql" and table_name="user";
87
85
# Bug #7215 information_schema: columns are longtext instead of varchar
88
86
# 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';
88
select table_schema, table_name, column_name from data_dictionary.columns where data_type = 'longtext';
89
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
92
# Bug #8164 subquery with data_dictionary.COLUMNS, 100 % CPU
99
SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES A
94
SELECT COUNT(*) FROM data_dictionary.tables A
101
(SELECT * FROM INFORMATION_SCHEMA.COLUMNS B
96
(SELECT * FROM data_dictionary.columns B
102
97
WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA
103
98
AND A.TABLE_NAME = B.TABLE_NAME);
142
136
create table t1(f1 LONGBLOB, f2 LONGTEXT);
143
137
select column_name,data_type,CHARACTER_OCTET_LENGTH,
144
138
CHARACTER_MAXIMUM_LENGTH
145
from information_schema.columns
139
from information_schema.old_columns
146
140
where table_name='t1';
148
142
create table t1(f1 int, f2 int, f3 BIGINT, f4 int,
149
143
f5 BIGINT, f6 int, f7 int);
150
144
select column_name, NUMERIC_PRECISION, NUMERIC_SCALE
151
from information_schema.columns
145
from information_schema.old_columns
152
146
where table_name='t1';
210
204
create table t1(f1 varbinary(32), f2 varbinary(64));
211
205
select character_maximum_length, character_octet_length
212
from information_schema.columns where table_name='t1';
206
from information_schema.old_columns where table_name='t1';
216
210
# Bug#15307 GROUP_CONCAT() with ORDER BY returns empty set on information_schema
218
212
select column_type, group_concat(table_schema, '.', table_name), count(*) as num
219
from information_schema.columns where
213
from information_schema.old_columns where
220
214
table_schema='information_schema' and
221
215
(column_type = 'varchar(7)' or column_type = 'varchar(20)'
222
216
or column_type = 'varchar(27)')
247
241
SELECT t.table_name, c1.column_name
248
FROM information_schema.tables t
242
FROM data_dictionary.tables t
250
information_schema.columns c1
244
information_schema.old_columns c1
251
245
ON t.table_schema = c1.table_schema AND
252
246
t.table_name = c1.table_name
253
247
WHERE t.table_schema = 'information_schema' AND
254
248
c1.ordinal_position =
255
249
( SELECT COALESCE(MIN(c2.ordinal_position),1)
256
FROM information_schema.columns c2
250
FROM information_schema.old_columns c2
257
251
WHERE c2.table_schema = t.table_schema AND
258
252
c2.table_name = t.table_name AND
259
253
c2.column_name LIKE '%SCHEMA%'
261
255
AND t.table_name NOT LIKE 'falcon%'
262
AND t.plugin_name IS NULL;
256
ORDER BY t.table_name, c1.column_name;
263
258
SELECT t.table_name, c1.column_name
264
FROM information_schema.tables t
259
FROM data_dictionary.tables t
266
information_schema.columns c1
261
information_schema.old_columns c1
267
262
ON t.table_schema = c1.table_schema AND
268
263
t.table_name = c1.table_name
269
264
WHERE t.table_schema = 'information_schema' AND
270
265
c1.ordinal_position =
271
266
( SELECT COALESCE(MIN(c2.ordinal_position),1)
272
FROM information_schema.columns c2
267
FROM information_schema.old_columns c2
273
268
WHERE c2.table_schema = 'information_schema' AND
274
269
c2.table_name = t.table_name AND
275
270
c2.column_name LIKE '%SCHEMA%'
277
272
AND t.table_name NOT LIKE 'falcon%'
278
AND t.plugin_name IS NULL;
273
ORDER BY t.table_name, c1.column_name;
281
276
# Bug#21231: query with a simple non-correlated subquery over
282
277
# INFORMARTION_SCHEMA.TABLES
285
SELECT MAX(table_name) FROM information_schema.tables;
286
SELECT table_name from information_schema.tables
280
SELECT MAX(table_name) FROM data_dictionary.tables;
281
SELECT table_name from data_dictionary.tables
287
282
WHERE table_name=(SELECT MAX(table_name)
288
FROM information_schema.tables);
283
FROM data_dictionary.tables)
290
286
# Bug#23299 Some queries against INFORMATION_SCHEMA with subqueries fail
292
288
create table t1 (f1 int);
293
289
create table t2 (f1 int, f2 int);
295
select table_name from information_schema.tables
291
select table_name from data_dictionary.tables
296
292
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');
293
(select table_name from information_schema.old_columns
294
where table_schema = 'test' and column_name = 'f3')
299
297
drop table t1,t2;
303
301
# 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
303
select 1 as f1 from data_dictionary.tables where "CHARACTER_SETS"=
304
(select cast(table_name as char) from data_dictionary.tables
307
305
order by table_name limit 1) limit 1;
309
307
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
309
from data_dictionary.tables t
310
inner join information_schema.old_columns c1
313
311
on t.table_schema = c1.table_schema AND t.table_name = c1.table_name
314
312
where t.table_schema = 'information_schema' AND
315
313
t.table_name not like 'falcon%' AND
316
t.plugin_name IS NULL AND
317
314
c1.ordinal_position =
318
315
(select isnull(c2.column_type) -
319
316
isnull(group_concat(c2.table_schema, '.', c2.table_name)) +
321
from information_schema.columns c2 where
318
from information_schema.old_columns c2 where
322
319
c2.table_schema='information_schema' and
323
320
(c2.column_type = 'varchar(7)' or c2.column_type = 'varchar(20)')
324
321
group by c2.column_type order by num limit 1)
363
360
--echo End of 5.0 tests.
366
# Bug#30795 Query on INFORMATION_SCHEMA.SCHEMATA, wrong result
363
# Bug#30795 Query on data_dictionary.schemas, wrong result
368
SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA
365
SELECT SCHEMA_NAME FROM data_dictionary.schemas
369
366
WHERE SCHEMA_NAME ='information_schema';
372
369
# Bug#31381 Error in retrieving Data from INFORMATION_SCHEMA
374
SELECT TABLE_COLLATION FROM INFORMATION_SCHEMA.TABLES
371
SELECT TABLE_COLLATION FROM data_dictionary.tables
375
372
WHERE TABLE_SCHEMA='mysql' and TABLE_NAME= 'db';
378
375
# 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;
377
select * from data_dictionary.columns where table_schema = NULL;
378
select * from `data_dictionary`.`columns` where `TABLE_NAME` = NULL;
379
select * from `information_schema`.`OLD_KEY_COLUMN_USAGE` where `TABLE_SCHEMA` = NULL;
380
select * from `information_schema`.`OLD_KEY_COLUMN_USAGE` where `TABLE_NAME` = NULL;
381
select * from `information_schema`.`OLD_REFERENTIAL_CONSTRAINTS` where `CONSTRAINT_SCHEMA` = NULL;
382
select * from `information_schema`.`OLD_REFERENTIAL_CONSTRAINTS` where `TABLE_NAME` = NULL;
383
select * from data_dictionary.schemas where schema_name = NULL;
384
select * from `information_schema`.`OLD_STATISTICS` where `TABLE_SCHEMA` = NULL;
385
select * from `information_schema`.`OLD_STATISTICS` where `TABLE_NAME` = NULL;
386
select * from data_dictionary.tables where table_schema = NULL;
387
select * from data_dictionary.tables where table_name = NULL;
388
select * from `information_schema`.`OLD_TABLE_CONSTRAINTS` where `TABLE_SCHEMA` = NULL;
389
select * from `information_schema`.`OLD_TABLE_CONSTRAINTS` where `TABLE_NAME` = NULL;
396
392
--echo # Test that the query is visible to self and others.
399
SELECT info FROM information_schema.processlist WHERE id = CONNECTION_ID();
395
SELECT info FROM data_dictionary.processlist WHERE id = CONNECTION_ID();
402
398
# test that SHOW PROCESSLIST works correctly
408
404
# do a query on the PROCESSLIST table in I_S to ensure it works correctly
410
406
SELECT info, command, db
411
FROM information_schema.processlist
407
FROM data_dictionary.processlist
412
408
WHERE id = CONNECTION_ID();
415
411
# do a query on the CHARACTER_SET table in I_S
418
FROM information_schema.character_sets
414
FROM data_dictionary.character_sets
419
415
ORDER BY character_set_name;
422
418
# 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
421
FROM data_dictionary.collations
433
422
ORDER BY collation_name;
436
425
# perform a query on COLUMNS
438
427
SELECT table_name, column_name
439
FROM information_schema.columns
428
FROM data_dictionary.columns
440
429
WHERE table_name IN
441
(SELECT table_name FROM information_schema.tables
442
WHERE plugin_name IS NULL)
430
(SELECT table_name FROM data_dictionary.tables )
443
431
ORDER BY table_name;
446
434
# perform a query on KEY_COLUMN_USAGE
449
FROM information_schema.key_column_usage;
437
FROM information_schema.old_key_column_usage;
452
440
# perform a query on REFERENTIAL_CONSTRAINTS
455
FROM information_schema.referential_constraints;
443
FROM information_schema.old_referential_constraints;
458
446
# 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;
449
SELECT count(schema_name) FROM data_dictionary.schemas ORDER BY schema_name;
473
451
--replace_column 1 # 2 #
476
454
#--replace_column 1 # 2 #
478
#FROM information_schema.session_variables
456
#FROM information_schema.old_session_variables
479
457
#ORDER BY variable_name;
481
459
#--replace_column 1 # 2 #
484
462
--replace_column 1 # 2 #
486
FROM information_schema.global_status
464
FROM information_schema.old_global_status
487
465
ORDER BY variable_name;
489
467
#--replace_column 1 # 2 #
491
#FROM information_schema.global_variables
469
#FROM information_schema.old_global_variables
492
470
#ORDER BY variable_name;
495
473
# query TABLE_CONSTRAINTS table
498
FROM information_schema.table_constraints;
476
FROM information_schema.old_table_constraints;
503
481
SELECT table_schema, table_name
504
FROM information_schema.tables
505
WHERE plugin_name IS NULL
482
FROM data_dictionary.tables
483
WHERE table_schema="data_dictionary"
506
484
ORDER BY table_name;