diff options
author | Igor Babaev <igor@askmonty.org> | 2011-07-10 17:19:45 -0700 |
---|---|---|
committer | Igor Babaev <igor@askmonty.org> | 2011-07-10 17:19:45 -0700 |
commit | f8db35bd157f0e1c78cb86cb61200a9aaf7998c1 (patch) | |
tree | 635db0c8bf71399be55e5e07a519fee702e9a2be /mysql-test/t/derived_view.test | |
parent | 7ff45c1379472953074318623017ccb7a66b8426 (diff) | |
download | mariadb-git-f8db35bd157f0e1c78cb86cb61200a9aaf7998c1.tar.gz |
Fixed LP bug #806504.
Missing initialization of the bitmap not_null_tables_cache to 0
in the function Item_func::eval_not_null_tables caused this bug.
This function is called indirectly from the function
SELECT_LEX::update_used_tables after merging mergeable views and
derived tables into the main query. The leaf tables of resulting
query may change their bitmap numbers after this merge. That's why
the not_null_tables_cache bitmaps must be updated. Due to the bug
mentioned above the result of the re-evaluation of the
not_null_tables_cache turned out to be incorrect in some cases.
This could trigger an invalid conversion of outer joins into
inner joins leading to invalid query result sets.
Also removed an implicit conversion from int to bool in the function
SELECT_LEX::update_used_tables.
Diffstat (limited to 'mysql-test/t/derived_view.test')
-rw-r--r-- | mysql-test/t/derived_view.test | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/mysql-test/t/derived_view.test b/mysql-test/t/derived_view.test index d7055f71382..dcad590676c 100644 --- a/mysql-test/t/derived_view.test +++ b/mysql-test/t/derived_view.test @@ -531,3 +531,30 @@ SELECT DISTINCT v1.a FROM t1 LEFT JOIN v1 ON t1.b = 0; DROP VIEW v1; DROP TABLE t1,t2,t3; + +--echo # +--echo # LP bug #806504: right join over a view/derived table +--echo # + +CREATE TABLE t1 (a int, b int) ; +INSERT IGNORE INTO t1 VALUES (0,0); + +CREATE TABLE t2 (a int) ; +INSERT INTO t2 VALUES (0), (0); + +CREATE VIEW v1 AS SELECT * FROM t1; + +SELECT * FROM t2 RIGHT JOIN (SELECT * FROM t1) AS t ON t.a != 0 + WHERE t.a IN (SELECT b FROM t1); +EXPLAIN EXTENDED +SELECT * FROM t2 RIGHT JOIN (SELECT * FROM t1) AS t ON t.a != 0 + WHERE t.a IN (SELECT b FROM t1); + +SELECT * FROM t2 RIGHT JOIN v1 AS t ON t.a != 0 + WHERE t.a IN (SELECT b FROM t1); +EXPLAIN EXTENDED +SELECT * FROM t2 RIGHT JOIN v1 AS t ON t.a != 0 + WHERE t.a IN (SELECT b FROM t1); + +DROP VIEW v1; +DROP TABLE t1,t2; |