Commit 05af33b6 authored by unknown's avatar unknown

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
parent cb0d688d
...@@ -950,3 +950,9 @@ v1 CREATE VIEW test.v1 AS select `test`.`t1`.`a*b` AS `a*b` from `test`.`t1` ...@@ -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 view v1;
drop table t1; drop table t1;
set sql_mode=default; 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;
...@@ -861,3 +861,12 @@ show create view v1; ...@@ -861,3 +861,12 @@ show create view v1;
drop view v1; drop view v1;
drop table t1; drop table t1;
set sql_mode=default; 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;
...@@ -677,6 +677,11 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table) ...@@ -677,6 +677,11 @@ mysql_make_view(File_parser *parser, TABLE_LIST *table)
if ((tbl_end->next_global= old_next)) if ((tbl_end->next_global= old_next))
tbl_end->next_global->prev_global= &tbl_end->next_global; 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; table->derived= &lex->unit;
......
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