2005-05-06 21:06:10 +02:00
|
|
|
-- source include/testdb_only.inc
|
|
|
|
|
2006-05-30 07:45:23 +02:00
|
|
|
--disable_warnings
|
|
|
|
drop table if exists t1,t2;
|
|
|
|
drop view if exists v1,v2;
|
|
|
|
drop function if exists f1;
|
|
|
|
drop function if exists f2;
|
|
|
|
--enable_warnings
|
|
|
|
|
2005-05-06 21:06:10 +02:00
|
|
|
use INFORMATION_SCHEMA;
|
2005-05-24 12:35:23 +02:00
|
|
|
--replace_result Tables_in_INFORMATION_SCHEMA Tables_in_information_schema
|
2005-05-06 21:06:10 +02:00
|
|
|
show tables;
|
2005-05-24 12:35:23 +02:00
|
|
|
--replace_result 'Tables_in_INFORMATION_SCHEMA (T%)' 'Tables_in_information_schema (T%)'
|
2005-05-06 21:06:10 +02:00
|
|
|
show tables from INFORMATION_SCHEMA like 'T%';
|
|
|
|
create database `inf%`;
|
2006-05-30 07:45:23 +02:00
|
|
|
create database mbase;
|
2005-05-06 21:06:10 +02:00
|
|
|
use `inf%`;
|
|
|
|
show tables;
|
2006-03-20 10:42:02 +01:00
|
|
|
|
|
|
|
#
|
|
|
|
# Bug#18113 SELECT * FROM information_schema.xxx crashes server
|
2006-05-30 07:45:23 +02:00
|
|
|
# Bug#17204 second CALL to procedure crashes Server
|
2006-03-20 10:42:02 +01:00
|
|
|
# Crash happened when one selected data from one of INFORMATION_SCHEMA
|
|
|
|
# tables and in order to build its contents server had to open view which
|
|
|
|
# used stored function and table or view on which one had not global or
|
|
|
|
# database-level privileges (e.g. had only table-level or had no
|
|
|
|
# privileges at all).
|
|
|
|
#
|
|
|
|
grant all privileges on `inf%`.* to 'mysqltest_1'@'localhost';
|
2006-05-30 07:45:23 +02:00
|
|
|
grant all privileges on `mbase`.* to 'mysqltest_1'@'localhost';
|
2006-03-20 10:42:02 +01:00
|
|
|
create table t1 (f1 int);
|
|
|
|
delimiter |;
|
|
|
|
create function func1(curr_int int) returns int
|
|
|
|
begin
|
|
|
|
declare ret_val int;
|
|
|
|
select max(f1) from t1 into ret_val;
|
|
|
|
return ret_val;
|
|
|
|
end|
|
|
|
|
delimiter ;|
|
|
|
|
create view v1 as select f1 from t1 where f1 = func1(f1);
|
2006-05-30 07:45:23 +02:00
|
|
|
create function func2() returns int return 1;
|
|
|
|
|
|
|
|
use mbase;
|
|
|
|
delimiter |;
|
|
|
|
create procedure p1 ()
|
|
|
|
begin
|
|
|
|
select table_name from information_schema.key_column_usage
|
|
|
|
order by table_name;
|
|
|
|
end|
|
|
|
|
delimiter ;|
|
|
|
|
|
|
|
|
create table t1
|
|
|
|
(f1 int(10) unsigned not null,
|
|
|
|
f2 varchar(100) not null,
|
|
|
|
primary key (f1), unique key (f2));
|
|
|
|
|
2006-03-20 10:42:02 +01:00
|
|
|
connect (user1,localhost,mysqltest_1,,);
|
|
|
|
connection user1;
|
|
|
|
--disable_result_log
|
|
|
|
select * from information_schema.tables;
|
2006-05-30 07:45:23 +02:00
|
|
|
call mbase.p1();
|
|
|
|
call mbase.p1();
|
|
|
|
call mbase.p1();
|
2006-03-20 10:42:02 +01:00
|
|
|
--enable_result_log
|
2006-05-30 07:45:23 +02:00
|
|
|
|
2006-03-20 10:42:02 +01:00
|
|
|
connection default;
|
2006-05-30 07:45:23 +02:00
|
|
|
use `inf%`;
|
2006-03-20 10:42:02 +01:00
|
|
|
drop user mysqltest_1@localhost;
|
2006-05-30 07:45:23 +02:00
|
|
|
drop table t1;
|
|
|
|
select table_name, table_type, table_comment from information_schema.tables
|
|
|
|
where table_schema='inf%' and func2();
|
|
|
|
select table_name, table_type, table_comment from information_schema.tables
|
|
|
|
where table_schema='inf%' and func2();
|
2006-03-20 10:42:02 +01:00
|
|
|
drop view v1;
|
|
|
|
drop function func1;
|
2006-05-30 07:45:23 +02:00
|
|
|
drop function func2;
|
2006-03-20 10:42:02 +01:00
|
|
|
|
2005-05-06 21:06:10 +02:00
|
|
|
drop database `inf%`;
|
2006-05-30 07:45:23 +02:00
|
|
|
drop procedure mbase.p1;
|
|
|
|
drop database mbase;
|
|
|
|
|
|
|
|
#
|
|
|
|
# Bug#18282 INFORMATION_SCHEMA.TABLES provides inconsistent info about invalid views
|
|
|
|
#
|
|
|
|
use test;
|
|
|
|
create table t1 (i int);
|
|
|
|
create function f1 () returns int return (select max(i) from t1);
|
|
|
|
create view v1 as select f1();
|
|
|
|
create table t2 (id int);
|
|
|
|
create function f2 () returns int return (select max(i) from t2);
|
|
|
|
create view v2 as select f2();
|
|
|
|
drop table t2;
|
|
|
|
select table_name, table_type, table_comment from information_schema.tables
|
|
|
|
where table_schema='test';
|
|
|
|
drop table t1;
|
|
|
|
select table_name, table_type, table_comment from information_schema.tables
|
|
|
|
where table_schema='test';
|
|
|
|
drop function f1;
|
|
|
|
drop function f2;
|
|
|
|
drop view v1, v2;
|