2009-04-08 18:55:26 +02:00
# 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).
2022-10-04 11:26:50 +03:00
--source include/no_valgrind_without_big.inc
2022-06-09 10:32:51 +07:00
# 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
2009-04-08 18:55:26 +02:00
--source include/not_embedded.inc
2016-12-27 19:40:07 +01:00
--source include/have_innodb.inc
2014-11-12 06:27:56 +04:00
--source include/have_perfschema.inc
2010-05-14 14:56:14 +03:00
--source include/not_staging.inc
2009-04-08 18:55:26 +02:00
use INFORMATION_SCHEMA;
--replace_result Tables_in_INFORMATION_SCHEMA Tables_in_information_schema
2012-01-09 13:49:47 +02:00
--sorted_result
2009-04-08 18:55:26 +02:00
show tables;
#
2010-09-12 14:37:27 +02:00
# Bug#18925: subqueries with MIN/MAX functions on INFORMATION_SCHEMA
2009-04-08 18:55:26 +02:00
#
2012-11-09 11:56:27 +02:00
--sorted_result
2009-04-08 18:55:26 +02:00
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%'
2012-01-09 13:49:47 +02:00
) order by t.table_name;
2012-11-09 11:56:27 +02:00
--sorted_result
2009-04-08 18:55:26 +02:00
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%'
2012-01-09 13:49:47 +02:00
) order by t.table_name;
2009-04-08 18:55:26 +02:00
#
# Bug#24630 Subselect query crashes mysqld
#
2013-12-22 17:06:50 +01:00
select 1 as "must be 1" from information_schema.tables where "ACCOUNTS"=
2009-04-08 18:55:26 +02:00
(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
#
2012-01-09 13:49:47 +02:00
--sorted_result
2009-04-08 18:55:26 +02:00
--exec $MYSQL_SHOW information_schema
2012-01-09 13:49:47 +02:00
--sorted_result
2009-04-08 18:55:26 +02:00
--exec $MYSQL_SHOW INFORMATION_SCHEMA
2012-01-09 13:49:47 +02:00
--sorted_result
2009-04-08 18:55:26 +02:00
--exec $MYSQL_SHOW inf_rmation_schema
#
# Bug #9404 information_schema: Weird error messages
# with SELECT SUM() ... GROUP BY queries
#
2014-08-21 18:11:46 +02:00
SELECT table_schema, count(*) FROM information_schema.TABLES WHERE table_schema IN ('mysql', 'INFORMATION_SCHEMA', 'test', 'mysqltest') GROUP BY TABLE_SCHEMA;