Commit 53862e60 authored by unknown's avatar unknown
Browse files

Fix for bug#18224 VIEW on information_schema crashes the server

  additional check for subselect


mysql-test/r/information_schema.result:
  Fix for bug#18224 VIEW on information_schema crashes the server
    test case
mysql-test/t/information_schema.test:
  Fix for bug#18224 VIEW on information_schema crashes the server
    test case
parent ce39d294
Loading
Loading
Loading
Loading
+7 −0
Original line number Diff line number Diff line
@@ -281,6 +281,13 @@ sub1 sub1
select count(*) from information_schema.ROUTINES;
count(*)
2
create view v1 as select routine_schema, routine_name from information_schema.routines 
order by routine_schema, routine_name;
select * from v1;
routine_schema	routine_name
test	sel2
test	sub1
drop view v1;
select ROUTINE_NAME, ROUTINE_DEFINITION from information_schema.ROUTINES;
ROUTINE_NAME	ROUTINE_DEFINITION
show create function sub1;
+5 −0
Original line number Diff line number Diff line
@@ -142,6 +142,11 @@ select a.ROUTINE_NAME, b.name from information_schema.ROUTINES a,
mysql.proc b where a.ROUTINE_NAME = convert(b.name using utf8) order by 1;
select count(*) from information_schema.ROUTINES;

create view v1 as select routine_schema, routine_name from information_schema.routines 
order by routine_schema, routine_name;
select * from v1;
drop view v1;

connect (user1,localhost,mysqltest_1,,);
connection user1;
select ROUTINE_NAME, ROUTINE_DEFINITION from information_schema.ROUTINES;
+2 −1
Original line number Diff line number Diff line
@@ -3864,7 +3864,8 @@ bool get_schema_tables_result(JOIN *join)
    TABLE_LIST *table_list= tab->table->pos_in_table_list;
    if (table_list->schema_table && thd->fill_derived_tables())
    {
      bool is_subselect= (&lex->unit != lex->current_select->master_unit());
      bool is_subselect= (&lex->unit != lex->current_select->master_unit() &&
                          lex->current_select->master_unit()->item);
      /*
        The schema table is already processed and 
        the statement is not a subselect.