diff options
author | Igor Babaev <igor@askmonty.org> | 2011-07-08 16:39:28 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2011-07-08 16:39:28 -0700 |
commit | 5ead4083ec052f458f13dc0bfbc2184dac7ee133 (patch) | |
tree | 7a1b5183628689b0361a5eab844f93c977561880 /mysql-test/r/derived_view.result | |
parent | f222a5134050822deddcbd5e14e5b5a2296dbd15 (diff) | |
download | mariadb-git-5ead4083ec052f458f13dc0bfbc2184dac7ee133.tar.gz |
Fixed LP bug #806510.
The bug was caused by an incorrect code of the function
Item_direct_view_ref::replace_equal_field introduced in the
patch for bugs 717577, 724942. The function erroneously
returned the wrapped field instead of the Item_direct_view_ref
object itself in the cases when no replacement happened.
The bug masked two other minor bugs that could result in not
quite correct output of the EXPLAIN command for some queries.
They were fixed in the patch as well.
Diffstat (limited to 'mysql-test/r/derived_view.result')
-rw-r--r-- | mysql-test/r/derived_view.result | 52 |
1 files changed, 52 insertions, 0 deletions
diff --git a/mysql-test/r/derived_view.result b/mysql-test/r/derived_view.result index bc8fec82275..fed5b23dc7b 100644 --- a/mysql-test/r/derived_view.result +++ b/mysql-test/r/derived_view.result @@ -848,3 +848,55 @@ Warnings: Note 1003 select `test`.`t3`.`b` AS `b`,`test`.`t1`.`a` AS `a` from `test`.`t3` left join (`test`.`t2` join `test`.`t1`) on((`test`.`t3`.`a` <> 0)) where ((`test`.`t1`.`a` = `test`.`t1`.`a`) or (`test`.`t3`.`b` <> 0)) DROP VIEW v1; DROP TABLE t1,t2,t3; +# +# LP bug #806510: subquery with outer reference +# to a derived_table/view +# +CREATE TABLE t1 (a int) ; +INSERT INTO t1 VALUES (4), (NULL); +CREATE TABLE t2 (a int) ; +INSERT INTO t2 VALUES (8), (0); +CREATE TABLE t3 (a int, b int) ; +INSERT INTO t3 VALUES (7,8); +CREATE VIEW v1 AS SELECT * FROM t1; +SELECT * FROM t1 t +WHERE EXISTS (SELECT t3.a FROM t3, t2 +WHERE t2.a = t3.b AND t.a != 0); +a +4 +EXPLAIN +SELECT * FROM t1 t +WHERE EXISTS (SELECT t3.a FROM t3, t2 +WHERE t2.a = t3.b AND t.a != 0); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +SELECT * FROM (SELECT * FROM t1) t +WHERE EXISTS (SELECT t3.a FROM t3, t2 +WHERE t2.a = t3.b AND t.a != 0); +a +4 +EXPLAIN +SELECT * FROM (SELECT * FROM t1) t +WHERE EXISTS (SELECT t3.a FROM t3, t2 +WHERE t2.a = t3.b AND t.a != 0); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where +3 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 1 +3 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +SELECT * FROM v1 t +WHERE EXISTS (SELECT t3.a FROM t3, t2 +WHERE t2.a = t3.b AND t.a != 0); +a +4 +EXPLAIN +SELECT * FROM v1 t +WHERE EXISTS (SELECT t3.a FROM t3, t2 +WHERE t2.a = t3.b AND t.a != 0); +id select_type table type possible_keys key key_len ref rows Extra +1 PRIMARY t1 ALL NULL NULL NULL NULL 2 Using where +2 DEPENDENT SUBQUERY t3 system NULL NULL NULL NULL 1 +2 DEPENDENT SUBQUERY t2 ALL NULL NULL NULL NULL 2 Using where +DROP VIEW v1; +DROP TABLE t1,t2,t3; |