summaryrefslogtreecommitdiff
path: root/mysql-test/main/information_schema_all_engines.test
blob: 737b60c7616a6d0bd06cef96e3b9d57cfa4592f2 (plain)
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
# This file contains tests moved from information_schema.test and
# information_schema_db.test whose results depends on which engines are
# available (since these engines inject tables into INFORMATION_SCHEMA).

--source include/no_valgrind_without_big.inc

# Tests will be skipped for the view protocol because the view protocol creates 
# an additional util connection and other statistics data
-- source include/no_view_protocol.inc

--source include/not_embedded.inc
--source include/have_innodb.inc
--source include/have_perfschema.inc
--source include/not_staging.inc

use INFORMATION_SCHEMA;
--replace_result Tables_in_INFORMATION_SCHEMA Tables_in_information_schema
--sorted_result
show tables;

#
# Bug#18925: subqueries with MIN/MAX functions on INFORMATION_SCHEMA 
#

--sorted_result
SELECT t.table_name, c1.column_name
  FROM information_schema.tables t
       INNER JOIN
       information_schema.columns c1
       ON t.table_schema = c1.table_schema AND
          t.table_name = c1.table_name
  WHERE t.table_schema = 'information_schema' AND
        c1.ordinal_position =
        ( SELECT COALESCE(MIN(c2.ordinal_position),1)
            FROM information_schema.columns c2
            WHERE c2.table_schema = t.table_schema AND
                  c2.table_name = t.table_name AND
                  c2.column_name LIKE '%SCHEMA%'
        ) order by t.table_name;
--sorted_result
SELECT t.table_name, c1.column_name
  FROM information_schema.tables t
       INNER JOIN
       information_schema.columns c1
       ON t.table_schema = c1.table_schema AND
          t.table_name = c1.table_name
  WHERE t.table_schema = 'information_schema' AND
        c1.ordinal_position =
        ( SELECT COALESCE(MIN(c2.ordinal_position),1)
            FROM information_schema.columns c2
            WHERE c2.table_schema = 'information_schema' AND
                  c2.table_name = t.table_name AND
                  c2.column_name LIKE '%SCHEMA%'
        ) order by t.table_name;

#
# Bug#24630  Subselect query crashes mysqld
#
select 1 as "must be 1" from information_schema.tables  where "ACCOUNTS"=
(select cast(table_name as char)  from information_schema.tables
 order by table_name limit 1) limit 1;

select t.table_name, group_concat(t.table_schema, '.', t.table_name),
       count(*) as num1
from information_schema.tables t
inner join information_schema.columns c1
on t.table_schema = c1.table_schema AND t.table_name = c1.table_name
where t.table_schema = 'information_schema' and
        c1.ordinal_position =
        (select isnull(c2.column_type) -
         isnull(group_concat(c2.table_schema, '.', c2.table_name)) +
         count(*) as num
         from information_schema.columns c2 where
         c2.table_schema='information_schema' and
         (c2.column_type = 'varchar(7)' or c2.column_type = 'varchar(20)')
          group by c2.column_type order by num limit 1)
group by t.table_name order by num1, t.table_name;

#
# Bug #19147: mysqlshow INFORMATION_SCHEMA does not work
#
--sorted_result
--exec $MYSQL_SHOW information_schema
--sorted_result
--exec $MYSQL_SHOW INFORMATION_SCHEMA
--sorted_result
--exec $MYSQL_SHOW inf_rmation_schema

#
# Bug #9404  information_schema: Weird error messages
# with SELECT SUM() ... GROUP BY queries
#
SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') GROUP BY TABLE_SCHEMA;