Commit ba98de43 authored by unknown's avatar unknown

fixed problem in view over view setup (BUG#7433)


mysql-test/r/view.result:
  view over other view setup
mysql-test/t/view.test:
  view over other view setup
sql/table.cc:
  before using ancestor, check that it exists
parent 913d1e97
......@@ -1750,3 +1750,11 @@ c1
1
drop view v2, v1;
drop table t1, t2;
CREATE TABLE t1 (C1 INT, C2 INT);
CREATE TABLE t2 (C2 INT);
CREATE VIEW v1 AS SELECT C2 FROM t2;
CREATE VIEW v2 AS SELECT C1 FROM t1 LEFT OUTER JOIN v1 USING (C2);
SELECT * FROM v2;
C1
drop view v2, v1;
drop table t1, t2;
......@@ -1679,3 +1679,14 @@ select * from v1;
select * from v2;
drop view v2, v1;
drop table t1, t2;
#
# view over other view setup (BUG#7433)
#
CREATE TABLE t1 (C1 INT, C2 INT);
CREATE TABLE t2 (C2 INT);
CREATE VIEW v1 AS SELECT C2 FROM t2;
CREATE VIEW v2 AS SELECT C1 FROM t1 LEFT OUTER JOIN v1 USING (C2);
SELECT * FROM v2;
drop view v2, v1;
drop table t1, t2;
......@@ -1613,7 +1613,7 @@ void st_table_list::set_ancestor()
tbl->table->grant= grant;
}
/* if view contain only one table, substitute TABLE of it */
if (!ancestor->next_local)
if (ancestor && !ancestor->next_local)
{
table= ancestor->table;
schema_table= ancestor->schema_table;
......
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