~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to tests/t/information_schema.test

  • Committer: Brian Aker
  • Date: 2010-02-07 01:33:54 UTC
  • Revision ID: brian@gaz-20100207013354-d2pg1n68u5c09pgo
Remove giant include header to its own file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# check that CSV engine was compiled in, as the result of the test depends
2
 
# on the presence of the log tables (which are CSV-based).
3
 
--source include/have_csv.inc
4
 
 
5
1
# Test for information_schema.schemata &
6
2
# show databases
7
3
 
10
6
--enable_warnings
11
7
 
12
8
 
13
 
show variables where variable_name like "skip_show_database";
14
 
 
15
 
 
16
9
select * from information_schema.SCHEMATA where schema_name > 'm';
17
10
select schema_name from information_schema.schemata;
18
11
show databases like 't%';
19
12
show databases;
20
 
show databases where `database` = 't%';
21
13
 
22
14
# Test for information_schema.tables &
23
15
# show tables
34
26
where table_schema = "mysqltest" and table_name like "t%";
35
27
 
36
28
select * from information_schema.STATISTICS where TABLE_SCHEMA = "mysqltest";
37
 
show keys from t3 where Key_name = "a_data";
38
29
 
39
30
show tables like 't%';
40
31
--replace_column 8 # 12 # 13 #
41
 
show table status;
 
32
#show table status;
42
33
show full columns from t3 like "a%";
43
34
select * from information_schema.COLUMNS where table_name="t1"
44
35
and column_name= "a";
45
 
show columns from mysqltest.t1 where field like "%a%";
46
36
 
47
37
connect (user3,localhost,mysqltest_2,,);
48
38
connection user3;
61
51
 
62
52
select * from information_schema.CHARACTER_SETS
63
53
where CHARACTER_SET_NAME like 'latin1%';
64
 
SHOW CHARACTER SET LIKE 'latin1%';
65
 
SHOW CHARACTER SET WHERE charset like 'latin1%';
66
54
 
67
55
# Test for information_schema.COLLATIONS &
68
56
# SHOW COLLATION
70
58
--replace_column 5 #
71
59
select * from information_schema.COLLATIONS
72
60
where COLLATION_NAME like 'latin1%';
73
 
--replace_column 5 #
74
 
SHOW COLLATION LIKE 'latin1%';
75
 
--replace_column 5 #
76
 
SHOW COLLATION WHERE collation like 'latin1%';
77
61
 
78
62
select * from information_schema.COLLATION_CHARACTER_SET_APPLICABILITY
79
63
where COLLATION_NAME like 'latin1%';
99
83
select table_type from information_schema.tables
100
84
where table_schema="mysql" and table_name="user";
101
85
 
102
 
# test for 'show open tables ... where'
103
 
show open tables where `table` like "user";
104
 
# test for 'show status ... where'
105
 
show status where variable_name like "%database%";
106
 
# test for 'show variables ... where'
107
 
show variables where variable_name like "skip_show_databas";
108
 
 
109
 
#
110
 
# Bug #7981:SHOW GLOBAL STATUS crashes server
111
 
#
112
 
# We don't actually care about the value, just that it doesn't crash.
113
 
--replace_column 2 #
114
 
show global status like "Threads_running";
115
 
 
116
86
#
117
87
# Bug #7215  information_schema: columns are longtext instead of varchar
118
88
# Bug #7217  information_schema: columns are varbinary() instead of timestamp
139
109
create table t1
140
110
( x_bigint BIGINT,
141
111
  x_integer INTEGER,
142
 
  x_smallint SMALLINT,
 
112
  x_int int,
143
113
  x_decimal DECIMAL(5,3),
144
114
  x_numeric NUMERIC(5,3),
145
115
  x_real REAL,
155
125
# with SELECT SUM() ... GROUP BY queries
156
126
#
157
127
SELECT table_schema, count(*) FROM information_schema.TABLES
158
 
WHERE table_name NOT LIKE 'ndb_%' AND table_name NOT LIKE 'falcon%' GROUP BY TABLE_SCHEMA;
 
128
WHERE table_name NOT LIKE 'ndb_%' AND 
 
129
table_name NOT LIKE 'falcon%' AND
 
130
plugin_name IS NULL
 
131
GROUP BY TABLE_SCHEMA;
159
132
 
160
133
#
161
134
# Bug #9434 SHOW CREATE DATABASE information_schema;
172
145
from information_schema.columns
173
146
where table_name='t1';
174
147
drop table t1;
175
 
create table t1(f1 tinyint, f2 SMALLINT, f3 BIGINT, f4 int,
176
 
                f5 BIGINT, f6 TINYINT, f7 SMALLINT);
 
148
create table t1(f1 int, f2 int, f3 BIGINT, f4 int,
 
149
                f5 BIGINT, f6 int, f7 int);
177
150
select column_name, NUMERIC_PRECISION, NUMERIC_SCALE
178
151
from information_schema.columns
179
152
where table_name='t1';
191
164
drop table t1;
192
165
 
193
166
#
194
 
# Bug #12636: SHOW TABLE STATUS with where condition containing a subquery
195
 
#             over information schema
196
 
#
197
 
 
198
 
CREATE TABLE t1 (a int);
199
 
CREATE TABLE t2 (b int);
200
 
 
201
 
--replace_column 8 # 12 # 13 #
202
 
SHOW TABLE STATUS FROM test
203
 
  WHERE name IN ( SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES
204
 
                    WHERE TABLE_SCHEMA='test' AND TABLE_TYPE='BASE TABLE');
205
 
 
206
 
DROP TABLE t1,t2;
207
 
 
208
 
#
209
167
# Bug #9846 Inappropriate error displayed while dropping table from 'INFORMATION_SCHEMA'
210
168
#
211
169
--error ER_PARSE_ERROR
212
170
alter database information_schema;
213
171
--error ER_DBACCESS_DENIED_ERROR
214
172
drop database information_schema;
215
 
--error 1044
216
 
drop table information_schema.tables;
217
 
--error 1044
218
 
alter table information_schema.tables;
 
173
use information_schema;
 
174
--error 1044
 
175
drop table tables;
 
176
--error 1044
 
177
alter table tables;
219
178
#
220
179
# Bug #9683 INFORMATION_SCH: Creation of temporary table allowed in Information_schema DB
221
180
#
261
220
table_schema='information_schema' and
262
221
(column_type = 'varchar(7)' or column_type = 'varchar(20)'
263
222
 or column_type = 'varchar(27)')
264
 
group by column_type order by num;
 
223
group by column_type order by column_type, num;
265
224
 
266
225
#
267
226
# Bug#19236 bad COLUMNS.CHARACTER_MAXIMUM_LENGHT and CHARACTER_OCTET_LENGTH
268
227
#
269
 
create table t1(f1 char(1) not null, f2 char(9) not null)
270
 
default character set utf8;
 
228
create table t1(f1 char(1) not null, f2 char(9) not null);
271
229
select CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTH from
272
230
information_schema.columns where table_schema='test' and table_name = 't1';
273
231
drop table t1;
300
258
                  c2.table_name = t.table_name AND
301
259
                  c2.column_name LIKE '%SCHEMA%'
302
260
        )
303
 
  AND t.table_name NOT LIKE 'falcon%';
 
261
  AND t.table_name NOT LIKE 'falcon%'
 
262
  AND t.plugin_name IS NULL;
304
263
SELECT t.table_name, c1.column_name
305
264
  FROM information_schema.tables t
306
265
       INNER JOIN
315
274
                  c2.table_name = t.table_name AND
316
275
                  c2.column_name LIKE '%SCHEMA%'
317
276
        )
318
 
  AND t.table_name NOT LIKE 'falcon%';
 
277
  AND t.table_name NOT LIKE 'falcon%'
 
278
  AND t.plugin_name IS NULL;
319
279
 
320
280
#
321
281
# Bug#21231: query with a simple non-correlated subquery over
353
313
on t.table_schema = c1.table_schema AND t.table_name = c1.table_name
354
314
where t.table_schema = 'information_schema' AND
355
315
      t.table_name not like 'falcon%' AND
 
316
      t.plugin_name IS NULL AND
356
317
        c1.ordinal_position =
357
318
        (select isnull(c2.column_type) -
358
319
         isnull(group_concat(c2.table_schema, '.', c2.table_name)) +
430
391
select * from information_schema.tables where table_name = NULL;
431
392
select * from `information_schema`.`TABLE_CONSTRAINTS` where `TABLE_SCHEMA` = NULL;
432
393
select * from `information_schema`.`TABLE_CONSTRAINTS` where `TABLE_NAME` = NULL;
 
394
 
 
395
--echo #
 
396
--echo # Test that the query is visible to self and others.
 
397
--echo #
 
398
 
 
399
SELECT info FROM information_schema.processlist WHERE id = CONNECTION_ID();
 
400
 
 
401
#
 
402
# test that SHOW PROCESSLIST works correctly
 
403
#
 
404
--replace_column 1 # 2 # 3 # 6 # 7 #
 
405
show processlist;
 
406
 
 
407
#
 
408
# do a query on the PROCESSLIST table in I_S to ensure it works correctly
 
409
#
 
410
SELECT info, command, db
 
411
FROM information_schema.processlist
 
412
WHERE id = CONNECTION_ID();
 
413
 
 
414
#
 
415
# do a query on the CHARACTER_SET table in I_S 
 
416
#
 
417
SELECT *
 
418
FROM information_schema.character_sets
 
419
ORDER BY character_set_name;
 
420
 
 
421
#
 
422
# perform a query on the COLLATIONS table
 
423
#
 
424
SELECT *
 
425
FROM information_schema.collations
 
426
ORDER BY collation_name;
 
427
 
 
428
#
 
429
# perform a query on COLLATION_CHARACTER_SET_APPLICABILITY
 
430
#
 
431
SELECT * 
 
432
FROM information_schema.collation_character_set_applicability
 
433
ORDER BY collation_name;
 
434
 
 
435
#
 
436
# perform a query on COLUMNS
 
437
#
 
438
SELECT table_name, column_name
 
439
FROM information_schema.columns
 
440
WHERE table_name IN
 
441
(SELECT table_name FROM information_schema.tables 
 
442
 WHERE plugin_name IS NULL)
 
443
ORDER BY table_name;
 
444
 
 
445
#
 
446
# perform a query on KEY_COLUMN_USAGE
 
447
#
 
448
SELECT *
 
449
FROM information_schema.key_column_usage;
 
450
 
 
451
#
 
452
# perform a query on REFERENTIAL_CONSTRAINTS
 
453
#
 
454
SELECT * 
 
455
FROM information_schema.referential_constraints;
 
456
 
 
457
#
 
458
# query the SCHEMATA table
 
459
#
 
460
SELECT catalog_name, schema_name
 
461
FROM information_schema.schemata
 
462
ORDER BY schema_name;
 
463
 
 
464
#
 
465
# Query the STATUS and VARIABLES related
 
466
# I_S related tables. 
 
467
#
 
468
--replace_column 1 # 2 #
 
469
SELECT *
 
470
FROM information_schema.session_status
 
471
ORDER BY variable_name;
 
472
 
 
473
--replace_column 1 # 2 #
 
474
SHOW STATUS;
 
475
 
 
476
#--replace_column 1 # 2 #
 
477
#SELECT *
 
478
#FROM information_schema.session_variables
 
479
#ORDER BY variable_name;
 
480
 
 
481
#--replace_column 1 # 2 #
 
482
#SHOW VARIABLES;
 
483
 
 
484
--replace_column 1 # 2 #
 
485
SELECT *
 
486
FROM information_schema.global_status
 
487
ORDER BY variable_name;
 
488
 
 
489
#--replace_column 1 # 2 #
 
490
#SELECT *
 
491
#FROM information_schema.global_variables
 
492
#ORDER BY variable_name;
 
493
 
 
494
#
 
495
# query TABLE_CONSTRAINTS table
 
496
#
 
497
SELECT *
 
498
FROM information_schema.table_constraints;
 
499
 
 
500
#
 
501
# query TABLES
 
502
#
 
503
SELECT table_schema, table_name
 
504
FROM information_schema.tables
 
505
WHERE plugin_name IS NULL
 
506
ORDER BY table_name;
 
507
 
 
508
 
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?
 
512
#
 
513
#SELECT *
 
514
#FROM plugins;