summaryrefslogtreecommitdiff
path: root/mysql-test/t/view.test
diff options
context:
space:
mode:
authorunknown <sanja@montyprogram.com>2012-09-05 23:23:58 +0300
committerunknown <sanja@montyprogram.com>2012-09-05 23:23:58 +0300
commit54bb28d4a151d0eb5c3b74edb40ddf6e118c124b (patch)
tree51f71f55c54b4fbf5bc0229527b40fc475d63211 /mysql-test/t/view.test
parent589c62fefec759a467b6dec1badb2cd283564845 (diff)
downloadmariadb-git-54bb28d4a151d0eb5c3b74edb40ddf6e118c124b.tar.gz
MDEV-486 LP BUG#1010116 fix.
Link view/derived table fields to a real table to check turning the table record to null row. Item_direct_view_ref wrapper now checks if table is turned to null row.
Diffstat (limited to 'mysql-test/t/view.test')
-rw-r--r--mysql-test/t/view.test30
1 files changed, 30 insertions, 0 deletions
diff --git a/mysql-test/t/view.test b/mysql-test/t/view.test
index 6f11d6909ea..bd3b485034d 100644
--- a/mysql-test/t/view.test
+++ b/mysql-test/t/view.test
@@ -4433,6 +4433,36 @@ select * from t1;
drop view v2,v1;
drop table t1;
+--echo #
+--echo # MDEV-486 LP BUG#1010116 Incorrect query results in
+--echo # view and derived tables
+--echo #
+
+SELECT
+`Derived1`.`id`,
+`Derived2`.`Val1`
+FROM (select 30631 as `id`) AS `Derived1` LEFT OUTER JOIN (SELECT
+2 as `id`,
+1 AS `Val1`
+FROM (select 30631 as `id`) AS `Derived3`) AS `Derived2` ON `Derived1`.`id` = `Derived2`.`id`;
+
+create table t1 ( id int );
+insert into t1 values (30631);
+create table t2 ( id int );
+insert into t2 values (30631);
+create algorithm=MERGE view v2 as select 2 as id, 1 as val1 from t2;
+select t1.*, v2.* from t1 left join v2 on t1.id = v2.id;
+drop view v2;
+drop table t1,t2;
+
+create table t1 ( id int );
+insert into t1 values (30631);
+create table t2 ( id int );
+insert into t2 values (30631);
+create algorithm=MERGE view v2 as select 2 as id, id is null as bbb, id as iddqd, 1 as val1 from t2;
+select t1.*, v2.* from t1 left join v2 on t1.id = v2.id;
+drop view v2;
+drop table t1,t2;
--echo # -----------------------------------------------------------------
--echo # -- End of 5.3 tests.
--echo # -----------------------------------------------------------------