diff options
author | unknown <sergefp@mysql.com> | 2005-04-25 04:00:35 +0400 |
---|---|---|
committer | unknown <sergefp@mysql.com> | 2005-04-25 04:00:35 +0400 |
commit | 85ef43b4d09ca3899f379868dfbc414e84fc700b (patch) | |
tree | ea2edb12bc40c578cf90553fc2f9b48b0c52a811 | |
parent | c3e4d6a291183988ba68e38c4fceb5e1e3986dbc (diff) | |
download | mariadb-git-85ef43b4d09ca3899f379868dfbc414e84fc700b.tar.gz |
Fix for BUG#8921: Make SHOW CREATE VIEW ignore temporary tables.
mysql-test/r/temp_table.result:
Testcase for BUG#8921
mysql-test/t/temp_table.test:
Testcase for BUG#8921
-rw-r--r-- | mysql-test/r/temp_table.result | 26 | ||||
-rw-r--r-- | mysql-test/t/temp_table.test | 15 | ||||
-rw-r--r-- | sql/sql_parse.cc | 4 |
3 files changed, 45 insertions, 0 deletions
diff --git a/mysql-test/r/temp_table.result b/mysql-test/r/temp_table.result index 2dd58f54327..f43fd09982a 100644 --- a/mysql-test/r/temp_table.result +++ b/mysql-test/r/temp_table.result @@ -97,3 +97,29 @@ Variable_name Value Created_tmp_disk_tables 0 Created_tmp_tables 2 drop table t1; +create temporary table t1 as select 'This is temp. table' A; +create view t1 as select 'This is view' A; +select * from t1; +A +This is temp. table +show create table t1; +Table Create Table +t1 CREATE TEMPORARY TABLE `t1` ( + `A` varchar(19) NOT NULL default '' +) ENGINE=MyISAM DEFAULT CHARSET=latin1 +show create view t1; +View Create View +t1 CREATE ALGORITHM=UNDEFINED VIEW `test`.`t1` AS select _latin1'This is view' AS `A` +drop view t1; +select * from t1; +A +This is temp. table +create view t1 as select 'This is view again' A; +select * from t1; +A +This is temp. table +drop table t1; +select * from t1; +A +This is view again +drop view t1; diff --git a/mysql-test/t/temp_table.test b/mysql-test/t/temp_table.test index 74276c7668c..eeb33515570 100644 --- a/mysql-test/t/temp_table.test +++ b/mysql-test/t/temp_table.test @@ -89,3 +89,18 @@ flush status; select * from t1 group by d; show status like "created_tmp%tables"; drop table t1; + +# Fix for BUG#8921: Check that temporary table is ingored by view commands. +create temporary table t1 as select 'This is temp. table' A; +create view t1 as select 'This is view' A; +select * from t1; +show create table t1; +show create view t1; +drop view t1; +select * from t1; +create view t1 as select 'This is view again' A; +select * from t1; +drop table t1; +select * from t1; +drop view t1; + diff --git a/sql/sql_parse.cc b/sql/sql_parse.cc index c5ef9f4e713..6453c726ee0 100644 --- a/sql/sql_parse.cc +++ b/sql/sql_parse.cc @@ -3010,6 +3010,10 @@ unsent_create_error: goto error; #else { + /* Ignore temporary tables if this is "SHOW CREATE VIEW" */ + if (lex->only_view) + first_table->skip_temporary= 1; + if (check_db_used(thd, all_tables) || check_access(thd, SELECT_ACL | EXTRA_ACL, first_table->db, &first_table->grant.privilege, 0, 0)) |