From 638dc7d9e9f62d8b81e8e1e2728c77c7aea50584 Mon Sep 17 00:00:00 2001 From: "gluh@gluh.mysql.r18.ru" <> Date: Wed, 16 Feb 2005 13:00:03 +0300 Subject: [PATCH] Fix for bug#7915: crash,JOIN VIEW, subquery, SELECT .. FROM INFORMATION_SCHEMA.COLUMNS --- mysql-test/r/information_schema.result | 6 ++++++ mysql-test/t/information_schema.test | 11 +++++++++++ sql/sql_lex.cc | 6 ++++++ 3 files changed, 23 insertions(+) diff --git a/mysql-test/r/information_schema.result b/mysql-test/r/information_schema.result index 9bf21e9f061..87e6062d411 100644 --- a/mysql-test/r/information_schema.result +++ b/mysql-test/r/information_schema.result @@ -604,3 +604,9 @@ Variable_name Value show global status like "Threads_running"; Variable_name Value Threads_running 1 +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; diff --git a/mysql-test/t/information_schema.test b/mysql-test/t/information_schema.test index c34dfc94576..baf817b7c84 100644 --- a/mysql-test/t/information_schema.test +++ b/mysql-test/t/information_schema.test @@ -352,3 +352,14 @@ show variables where variable_name like "skip_show_databas"; # Bug #7981:SHOW GLOBAL STATUS crashes server # 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; diff --git a/sql/sql_lex.cc b/sql/sql_lex.cc index 30c657c3b79..08cf4402b74 100644 --- a/sql/sql_lex.cc +++ b/sql/sql_lex.cc @@ -1733,6 +1733,12 @@ bool st_lex::can_not_use_merged() { case SQLCOM_CREATE_VIEW: case SQLCOM_SHOW_CREATE: + /* + SQLCOM_SHOW_FIELDS is necessary to make + information schema tables working correctly with views. + see get_schema_tables_result function + */ + case SQLCOM_SHOW_FIELDS: return TRUE; default: return FALSE;