1
0
mirror of https://github.com/MariaDB/server.git synced 2025-12-24 11:21:21 +03:00

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
This commit is contained in:
unknown
2005-01-31 10:43:36 +02:00
parent 913d1e97c1
commit ba98de430c
3 changed files with 20 additions and 1 deletions

View File

@@ -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;

View File

@@ -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;

View File

@@ -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;