mirror of
https://github.com/MariaDB/server.git
synced 2026-01-06 05:22:24 +03:00
subselect.result, subselect.test:
Added a test case for bug #9516. item_subselect.h: Fixed bug #9516. The bug was due to that fact that the class Item_subselect inherited the generic implementation of the function not_null_tables that was not valid for the objects of this class. As a result evaluation of the not_null_tables attribute was not correct for subqueries. This caused invalid transformations of outer joins into inner joins.
This commit is contained in:
@@ -2762,3 +2762,22 @@ WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2 IN ( 1 ) );
|
||||
c1 c2
|
||||
1 1
|
||||
DROP TABLE t1,t2;
|
||||
CREATE TABLE t1 ( c1 integer );
|
||||
INSERT INTO t1 VALUES ( 1 );
|
||||
INSERT INTO t1 VALUES ( 2 );
|
||||
INSERT INTO t1 VALUES ( 3 );
|
||||
INSERT INTO t1 VALUES ( 6 );
|
||||
CREATE TABLE t2 ( c2 integer );
|
||||
INSERT INTO t2 VALUES ( 1 );
|
||||
INSERT INTO t2 VALUES ( 4 );
|
||||
INSERT INTO t2 VALUES ( 5 );
|
||||
INSERT INTO t2 VALUES ( 6 );
|
||||
CREATE TABLE t3 ( c3 integer );
|
||||
INSERT INTO t3 VALUES ( 7 );
|
||||
INSERT INTO t3 VALUES ( 8 );
|
||||
SELECT c1,c2 FROM t1 LEFT JOIN t2 ON c1 = c2
|
||||
WHERE EXISTS (SELECT c3 FROM t3 WHERE c2 IS NULL );
|
||||
c1 c2
|
||||
2 NULL
|
||||
3 NULL
|
||||
DROP TABLE t1,t2,t3;
|
||||
|
||||
@@ -1773,3 +1773,29 @@ SELECT * FROM t1 LEFT JOIN t2 ON c1 = c2
|
||||
WHERE c2 IN ( SELECT c2 FROM t2 WHERE c2 IN ( 1 ) );
|
||||
|
||||
DROP TABLE t1,t2;
|
||||
|
||||
#
|
||||
# Test for bug #9516: wrong evaluation of not_null_tables attribute in SQ
|
||||
#
|
||||
|
||||
CREATE TABLE t1 ( c1 integer );
|
||||
INSERT INTO t1 VALUES ( 1 );
|
||||
INSERT INTO t1 VALUES ( 2 );
|
||||
INSERT INTO t1 VALUES ( 3 );
|
||||
INSERT INTO t1 VALUES ( 6 );
|
||||
|
||||
CREATE TABLE t2 ( c2 integer );
|
||||
INSERT INTO t2 VALUES ( 1 );
|
||||
INSERT INTO t2 VALUES ( 4 );
|
||||
INSERT INTO t2 VALUES ( 5 );
|
||||
INSERT INTO t2 VALUES ( 6 );
|
||||
|
||||
CREATE TABLE t3 ( c3 integer );
|
||||
INSERT INTO t3 VALUES ( 7 );
|
||||
INSERT INTO t3 VALUES ( 8 );
|
||||
|
||||
SELECT c1,c2 FROM t1 LEFT JOIN t2 ON c1 = c2
|
||||
WHERE EXISTS (SELECT c3 FROM t3 WHERE c2 IS NULL );
|
||||
|
||||
DROP TABLE t1,t2,t3;
|
||||
|
||||
|
||||
@@ -96,6 +96,7 @@ public:
|
||||
virtual bool exec();
|
||||
virtual void fix_length_and_dec();
|
||||
table_map used_tables() const;
|
||||
table_map not_null_tables() const { return 0; }
|
||||
bool const_item() const;
|
||||
inline table_map get_used_tables_cache() { return used_tables_cache; }
|
||||
inline bool get_const_item_cache() { return const_item_cache; }
|
||||
|
||||
Reference in New Issue
Block a user