From 9050c44cffd26d7ff24c5c7413d1126f22078671 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 20 Jul 2004 10:34:39 +0300 Subject: [PATCH] fix case what VIEW have not tables (BUG#4614) mysql-test/r/view.result: test of VIEW without tables mysql-test/t/view.test: test of VIEW without tables sql/sql_view.cc: fix case what VIEW have not tables --- mysql-test/r/view.result | 6 ++++++ mysql-test/t/view.test | 9 +++++++++ sql/sql_view.cc | 5 +++++ 3 files changed, 20 insertions(+) diff --git a/mysql-test/r/view.result b/mysql-test/r/view.result index 0a0f8d3034c..1e772b65412 100644 --- a/mysql-test/r/view.result +++ b/mysql-test/r/view.result @@ -950,3 +950,9 @@ v1 CREATE VIEW test.v1 AS select `test`.`t1`.`a*b` AS `a*b` from `test`.`t1` drop view v1; drop table t1; set sql_mode=default; +create table t1 (t_column int); +create view v1 as select 'a'; +select * from v1, t1; +a t_column +drop view v1; +drop table t1; diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test index a3902f613ef..ebc14f3753b 100644 --- a/mysql-test/t/view.test +++ b/mysql-test/t/view.test @@ -861,3 +861,12 @@ show create view v1; drop view v1; drop table t1; set sql_mode=default; + +# +# VIEW without tables +# +create table t1 (t_column int); +create view v1 as select 'a'; +select * from v1, t1; +drop view v1; +drop table t1; diff --git a/sql/sql_view.cc b/sql/sql_view.cc index 32d09cc63ef..c558d1c5d34 100644 --- a/sql/sql_view.cc +++ b/sql/sql_view.cc @@ -677,6 +677,11 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table) if ((tbl_end->next_global= old_next)) tbl_end->next_global->prev_global= &tbl_end->next_global; } + else + { + /* VIEW do not contain tables */ + table->next_global= old_next; + } } table->derived= &lex->unit;