diff options
author | Igor Babaev <igor@askmonty.org> | 2017-06-28 11:38:26 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2017-06-28 11:39:33 -0700 |
commit | e60802394743d990e71754716c5f3cc234f581c1 (patch) | |
tree | 9a14ce5fd68344cdba51e38bb54bc6f13212b45d /mysql-test/t/cte_nonrecursive.test | |
parent | 31ba0fa48d27715e82258b1e74401093e0ee17a2 (diff) | |
download | mariadb-git-e60802394743d990e71754716c5f3cc234f581c1.tar.gz |
Fixed the bug mdev-13107 and some similar unreported bugs.
The problems were in the code of sql_show.cc. There the tables
could be opened in such a way that mysql_derived_init() never
worked for CTE tables. As a result they were not marked as
derived and mysql_handle_derived() were not called for derived
tables used in their specifications.
Diffstat (limited to 'mysql-test/t/cte_nonrecursive.test')
-rw-r--r-- | mysql-test/t/cte_nonrecursive.test | 33 |
1 files changed, 33 insertions, 0 deletions
diff --git a/mysql-test/t/cte_nonrecursive.test b/mysql-test/t/cte_nonrecursive.test index 0cc63104fa5..361ab8de28e 100644 --- a/mysql-test/t/cte_nonrecursive.test +++ b/mysql-test/t/cte_nonrecursive.test @@ -681,3 +681,36 @@ SELECT * FROM cte; DROP TABLE cte; DROP TABLE t; + +--echo # +--echo # MDEV-13107: SHOW TABLE STATUS, SHOW CREATE VIEW +--echo # for CTEs that use derived tables +--echo # + +create table t1(a int) engine=myisam; +insert into t1 values (3), (1), (2); +create table t2 (b int) engine=myisam; +insert into t2 values (2), (10); + +create view v1 as +with t as (select s.a from (select t1.a from t1) s), + r as(select t.a from t2, t where t2.b=t.a) + select a from r; + +create view v2 as +with t as (select s.a from (select t1.a from t1) s), + r as(select t.a from t2, t where t2.b=t.a) + select a from t1; + +--disable_result_log +show table status; +--enable_result_log + +show create view v1; +show create view v2; + +select * from v1; +select * from v2; + +drop view v1,v2; +drop table t1,t2; |