📄 information_schema.test
字号:
## Bug#7212: information_schema: "Can't find file" errors if storage engine gone# Bug#7211: information_schema: crash if bad view#use test;create function sub1(i int) returns int return i+1;create table t1(f1 int);create view v2 (c) as select f1 from t1;create view v3 (c) as select sub1(1);create table t4(f1 int, KEY f1_key (f1));drop table t1;drop function sub1;select table_name from information_schema.viewswhere table_schema='test';select table_name from information_schema.viewswhere table_schema='test';select column_name from information_schema.columnswhere table_schema='test';select index_name from information_schema.statistics where table_schema='test';select constraint_name from information_schema.table_constraintswhere table_schema='test';show create view v2;show create table v3;drop view v2;drop view v3;drop table t4;## Bug#7213: information_schema: redundant non-standard TABLE_NAMES table#--error 1109select * from information_schema.table_names;## Bug#2719 information_schema: errors in "columns"#select column_type from information_schema.columnswhere table_schema="information_schema" and table_name="COLUMNS" and(column_name="character_set_name" or column_name="collation_name");## Bug#2718 information_schema: errors in "tables"#select TABLE_ROWS from information_schema.tables where table_schema="information_schema" and table_name="COLUMNS";select table_type from information_schema.tableswhere table_schema="mysql" and table_name="user";# test for 'show open tables ... where'show open tables where `table` like "user";# test for 'show status ... where'show status where variable_name like "%database%";# test for 'show variables ... where'show variables where variable_name like "skip_show_databas";## Bug #7981:SHOW GLOBAL STATUS crashes server## We don't actually care about the value, just that it doesn't crash.--replace_column 2 #show global status like "Threads_running";## Bug #7915 crash,JOIN VIEW, subquery, # SELECT .. FROM INFORMATION_SCHEMA.COLUMNS#create table t1(f1 int);create table t2(f2 int);create view v1 as select * from t1, t2;set @got_val= (select count(*) from information_schema.columns);drop view v1;drop table t1, t2;## Bug #7476: crash on SELECT * FROM INFORMATION_SCHEMA.TABLES#CREATE TABLE t_crashme ( f1 BIGINT);CREATE VIEW a1 (t_CRASHME) AS SELECT f1 FROM t_crashme GROUP BY f1;CREATE VIEW a2 AS SELECT t_CRASHME FROM a1;let $tab_count= 65;--disable_query_logwhile ($tab_count){ EVAL CREATE TABLE t_$tab_count (f1 BIGINT); dec $tab_count ;}--disable_result_logSELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES;--enable_result_logSELECT count(*) FROM INFORMATION_SCHEMA.TABLES;let $tab_count= 65;while ($tab_count){ EVAL DROP TABLE t_$tab_count; dec $tab_count ;}--enable_query_logdrop view a2, a1;drop table t_crashme;## Bug #7215 information_schema: columns are longtext instead of varchar# Bug #7217 information_schema: columns are varbinary() instead of timestamp#select table_schema,table_name, column_name frominformation_schema.columns where data_type = 'longtext';select table_name, column_name, data_type from information_schema.columnswhere data_type = 'datetime';## Bug #8164 subquery with INFORMATION_SCHEMA.COLUMNS, 100 % CPU#SELECT COUNT(*) FROM INFORMATION_SCHEMA.TABLES AWHERE NOT EXISTS (SELECT * FROM INFORMATION_SCHEMA.COLUMNS B WHERE A.TABLE_SCHEMA = B.TABLE_SCHEMA AND A.TABLE_NAME = B.TABLE_NAME);## Bug #9344 INFORMATION_SCHEMA, wrong content, numeric columns#create table t1( x_bigint BIGINT, x_integer INTEGER, x_smallint SMALLINT, x_decimal DECIMAL(5,3), x_numeric NUMERIC(5,3), x_real REAL, x_float FLOAT, x_double_precision DOUBLE PRECISION );SELECT COLUMN_NAME, CHARACTER_MAXIMUM_LENGTH, CHARACTER_OCTET_LENGTHFROM INFORMATION_SCHEMA.COLUMNSWHERE TABLE_NAME= 't1';drop table t1;## Bug#10261 INFORMATION_SCHEMA.COLUMNS, incomplete result for non root user#grant select on test.* to mysqltest_4@localhost;connect (user10261,localhost,mysqltest_4,,);connection user10261;SELECT TABLE_NAME, COLUMN_NAME, PRIVILEGES FROM INFORMATION_SCHEMA.COLUMNS where COLUMN_NAME='TABLE_NAME';connection default;delete from mysql.user where user='mysqltest_4';delete from mysql.db where user='mysqltest_4';flush privileges;## Bug #9404 information_schema: Weird error messages# with SELECT SUM() ... GROUP BY queries#SELECT table_schema, count(*) FROM information_schema.TABLES GROUP BY TABLE_SCHEMA;## TRIGGERS table test#create table t1 (i int, j int);delimiter |;create trigger trg1 before insert on t1 for each rowbegin if new.j > 10 then set new.j := 10; end if;end|create trigger trg2 before update on t1 for each rowbegin if old.i % 2 = 0 then set new.j := -1; end if;end|create trigger trg3 after update on t1 for each rowbegin if new.j = -1 then set @fired:= "Yes"; end if;end|delimiter ;|show triggers;select * from information_schema.triggers;drop trigger trg1;drop trigger trg2;drop trigger trg3;drop table t1;## Bug #10964 Information Schema:Authorization check on privilege tables is improper#create database mysqltest;create table mysqltest.t1 (f1 int, f2 int);create table mysqltest.t2 (f1 int);grant select (f1) on mysqltest.t1 to user1@localhost;grant select on mysqltest.t2 to user2@localhost;grant select on mysqltest.* to user3@localhost;grant select on *.* to user4@localhost;connect (con1,localhost,user1,,mysqltest);connect (con2,localhost,user2,,mysqltest);connect (con3,localhost,user3,,mysqltest);connect (con4,localhost,user4,,);connection con1;select * from information_schema.column_privileges order by grantee;select * from information_schema.table_privileges order by grantee;select * from information_schema.schema_privileges order by grantee;select * from information_schema.user_privileges order by grantee;show grants;connection con2;select * from information_schema.column_privileges order by grantee;select * from information_schema.table_privileges order by grantee;select * from information_schema.schema_privileges order by grantee;select * from information_schema.user_privileges order by grantee;show grants;connection con3;select * from information_schema.column_privileges order by grantee;select * from information_schema.table_privileges order by grantee;select * from information_schema.schema_privileges order by grantee;select * from information_schema.user_privileges order by grantee;show grants;connection con4;select * from information_schema.column_privileges where grantee like '%user%'order by grantee;select * from information_schema.table_privileges where grantee like '%user%'order by grantee;select * from information_schema.schema_privileges where grantee like '%user%'order by grantee;select * from information_schema.user_privileges where grantee like '%user%'order by grantee;show grants;connection default;drop user user1@localhost, user2@localhost, user3@localhost, user4@localhost;use test;drop database mysqltest;## Bug #11055 information_schema: routines.sql_data_access has wrong value#--disable_warningsdrop procedure if exists p1;drop procedure if exists p2;--enable_warningscreate procedure p1 () modifies sql data set @a = 5;create procedure p2 () set @a = 5;select sql_data_access from information_schema.routineswhere specific_name like 'p%';drop procedure p1;drop procedure p2;## Bug #9434 SHOW CREATE DATABASE information_schema;#show create database information_schema;## Bug #11057 information_schema: columns table has some questionable contents# Bug #12301 information_schema: NUMERIC_SCALE must be 0 for integer columns#create table t1(f1 LONGBLOB, f2 LONGTEXT);select column_name,data_type,CHARACTER_OCTET_LENGTH, CHARACTER_MAXIMUM_LENGTHfrom information_schema.columnswhere table_name='t1';drop table t1;create table t1(f1 tinyint, f2 SMALLINT, f3 mediumint, f4 int, f5 BIGINT, f6 BIT, f7 bit(64));select column_name, NUMERIC_PRECISION, NUMERIC_SCALEfrom information_schema.columnswhere table_name='t1';drop table t1;## Bug #12127 triggers do not show in info_schema before they are used if set to the database#create table t1 (f1 integer);create trigger tr1 after insert on t1 for each row set @test_var=42;use information_schema;select trigger_schema, trigger_name from triggers wheretrigger_name='tr1';use test;drop table t1;## Bug#12518 COLUMN_DEFAULT has wrong value if NOT NULL is set#create table t1 (a int not null, b int);use information_schema;select column_name, column_default from columns where table_schema='test' and table_name='t1';use test;show columns from t1;drop table t1;## Bug #12636: SHOW TABLE STATUS with where condition containing a subquery# over information schema#CREATE TABLE t1 (a int);CREATE TABLE t2 (b int);--replace_column 8 # 12 # 13 #SHOW TABLE STATUS FROM test WHERE name IN ( SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_SCHEMA='test' AND TABLE_TYPE='BASE TABLE');DROP TABLE t1,t2;## Bug #12905 show fields from view behaving erratically with current database#create table t1(f1 int);create view v1 (c) as select f1 from t1;connect (con5,localhost,root,,*NO-ONE*);select database();show fields from test.v1;connection default;drop view v1;drop table t1;## Bug #9846 Inappropriate error displayed while dropping table from 'INFORMATION_SCHEMA'#--error ER_PARSE_ERRORalter database information_schema;--error 1044drop database information_schema;--error 1044drop table information_schema.tables;--error 1044alter table information_schema.tables;## Bug #9683 INFORMATION_SCH: Creation of temporary table allowed in Information_schema DB#use information_schema;--error 1044create temporary table schemata(f1 char(10));## Bug #10708 SP's can use INFORMATION_SCHEMA as ROUTINE_SCHEMA#delimiter |;--error ER_BAD_DB_ERRORCREATE PROCEDURE p1 ()BEGIN SELECT 'foo' FROM DUAL;END |delimiter ;|select ROUTINE_NAME from routines;## Bug #10734 Grant of privileges other than 'select' and 'create view' should fail on schema#--error 1044grant all on information_schema.* to 'user1'@'localhost';--error 1044grant select on information_schema.* to 'user1'@'localhost';
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -