Commit a51db360 authored by unknown's avatar unknown

Fix for bug#7211: information_schema: crash if bad view(after review)

parent 4270b2d6
...@@ -599,6 +599,18 @@ create view t3 (c) as select sub1(1); ...@@ -599,6 +599,18 @@ create view t3 (c) as select sub1(1);
create table t4(f1 int, KEY f1_key (f1)); create table t4(f1 int, KEY f1_key (f1));
drop table t1; drop table t1;
drop function sub1; drop function sub1;
select table_name from information_schema.views
where table_schema='test';
table_name
Warnings:
Warning 1356 View 'test.t2' references invalid table(s) or column(s) or function(s)
Warning 1356 View 'test.t3' references invalid table(s) or column(s) or function(s)
select table_name from information_schema.views
where table_schema='test';
table_name
Warnings:
Warning 1356 View 'test.t2' references invalid table(s) or column(s) or function(s)
Warning 1356 View 'test.t3' references invalid table(s) or column(s) or function(s)
select column_name from information_schema.columns select column_name from information_schema.columns
where table_schema='test'; where table_schema='test';
column_name column_name
......
...@@ -295,6 +295,7 @@ show tables like "T%"; ...@@ -295,6 +295,7 @@ show tables like "T%";
# #
# Bug#7212: information_schema: "Can't find file" errors if storage engine gone # Bug#7212: information_schema: "Can't find file" errors if storage engine gone
# Bug#7211: information_schema: crash if bad view
# #
use test; use test;
create function sub1(i int) returns int create function sub1(i int) returns int
...@@ -305,6 +306,10 @@ create view t3 (c) as select sub1(1); ...@@ -305,6 +306,10 @@ create view t3 (c) as select sub1(1);
create table t4(f1 int, KEY f1_key (f1)); create table t4(f1 int, KEY f1_key (f1));
drop table t1; drop table t1;
drop function sub1; drop function sub1;
select table_name from information_schema.views
where table_schema='test';
select table_name from information_schema.views
where table_schema='test';
select column_name from information_schema.columns select column_name from information_schema.columns
where table_schema='test'; where table_schema='test';
select index_name from information_schema.statistics where table_schema='test'; select index_name from information_schema.statistics where table_schema='test';
......
...@@ -2871,7 +2871,14 @@ static int get_schema_views_record(THD *thd, struct st_table_list *tables, ...@@ -2871,7 +2871,14 @@ static int get_schema_views_record(THD *thd, struct st_table_list *tables,
table->file->write_row(table->record[0]); table->file->write_row(table->record[0]);
} }
} }
DBUG_RETURN(res); else
{
if (tables->view)
push_warning(thd, MYSQL_ERROR::WARN_LEVEL_WARN,
thd->net.last_errno, thd->net.last_error);
thd->clear_error();
}
DBUG_RETURN(0);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment