summaryrefslogtreecommitdiff
path: root/mysql-test/r/subselect4.result
diff options
context:
space:
mode:
authorMichael Widenius <monty@askmonty.org>2010-11-23 23:39:59 +0200
committerMichael Widenius <monty@askmonty.org>2010-11-23 23:39:59 +0200
commitb52020221e8b4e58d1bc6dd5a5a6f065a6a3a083 (patch)
tree6068b9d90b4127b1c3608e29913fa82bf1a1f20e /mysql-test/r/subselect4.result
parent7840965db9460e2117c163f3db83aaa247c65203 (diff)
parent498ee6bd19eabc85dcbd9abebc9cf6aeb79d1985 (diff)
downloadmariadb-git-b52020221e8b4e58d1bc6dd5a5a6f065a6a3a083.tar.gz
Merge with MySQL 5.1.52
Diffstat (limited to 'mysql-test/r/subselect4.result')
-rw-r--r--mysql-test/r/subselect4.result86
1 files changed, 86 insertions, 0 deletions
diff --git a/mysql-test/r/subselect4.result b/mysql-test/r/subselect4.result
index 87f52572e88..50c0d14968a 100644
--- a/mysql-test/r/subselect4.result
+++ b/mysql-test/r/subselect4.result
@@ -99,6 +99,92 @@ Note 1249 Select 2 was reduced during optimization
CREATE VIEW v1 AS SELECT 1 LIKE ( 1 IN ( SELECT 1 ) );
CREATE VIEW v2 AS SELECT 1 LIKE '%' ESCAPE ( 1 IN ( SELECT 1 ) );
DROP VIEW v1, v2;
+#
+# Bug#51070: Query with a NOT IN subquery predicate returns a wrong
+# result set
+#
+CREATE TABLE t1 ( a INT, b INT );
+INSERT INTO t1 VALUES ( 1, NULL ), ( 2, NULL );
+CREATE TABLE t2 ( c INT, d INT );
+INSERT INTO t2 VALUES ( NULL, 3 ), ( NULL, 4 );
+CREATE TABLE t3 ( e INT, f INT );
+INSERT INTO t3 VALUES ( NULL, NULL ), ( NULL, NULL );
+CREATE TABLE t4 ( a INT );
+INSERT INTO t4 VALUES (1), (2), (3);
+CREATE TABLE t5 ( a INT );
+INSERT INTO t5 VALUES (NULL), (2);
+EXPLAIN
+SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 );
+id select_type table type possible_keys key key_len ref rows Extra
+x PRIMARY x x x x x x x x
+x DEPENDENT SUBQUERY x x x x x x x x
+SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 );
+a b
+EXPLAIN
+SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ) IS NULL;
+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 t2 ALL NULL NULL NULL NULL 2 Using where
+SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ) IS NULL;
+a b
+1 NULL
+2 NULL
+SELECT * FROM t1 WHERE ( a, b ) IN ( SELECT c, d FROM t2 ) IS NULL;
+a b
+1 NULL
+2 NULL
+SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT c, d FROM t2 ) IS UNKNOWN;
+a b
+1 NULL
+2 NULL
+SELECT * FROM t1 WHERE (( a, b ) NOT IN ( SELECT c, d FROM t2 )) IS UNKNOWN;
+a b
+1 NULL
+2 NULL
+SELECT * FROM t1 WHERE 1 = 1 AND ( a, b ) NOT IN ( SELECT c, d FROM t2 );
+a b
+EXPLAIN
+SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT e, f FROM t3 );
+id select_type table type possible_keys key key_len ref rows Extra
+x PRIMARY x x x x x x x x
+x DEPENDENT SUBQUERY x x x x x x x x
+SELECT * FROM t1 WHERE ( a, b ) NOT IN ( SELECT e, f FROM t3 );
+a b
+EXPLAIN
+SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT a, b FROM t1 );
+id select_type table type possible_keys key key_len ref rows Extra
+x PRIMARY x x x x x x x x
+x DEPENDENT SUBQUERY x x x x x x x x
+SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT a, b FROM t1 );
+c d
+EXPLAIN
+SELECT * FROM t3 WHERE ( e, f ) NOT IN ( SELECT c, d FROM t2 );
+id select_type table type possible_keys key key_len ref rows Extra
+x PRIMARY x x x x x x x x
+x DEPENDENT SUBQUERY x x x x x x x x
+SELECT * FROM t3 WHERE ( e, f ) NOT IN ( SELECT c, d FROM t2 );
+e f
+EXPLAIN
+SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT e, f FROM t3 );
+id select_type table type possible_keys key key_len ref rows Extra
+x PRIMARY x x x x x x x x
+x DEPENDENT SUBQUERY x x x x x x x x
+SELECT * FROM t2 WHERE ( c, d ) NOT IN ( SELECT e, f FROM t3 );
+c d
+SELECT * FROM t1 WHERE ( a, b ) NOT IN
+( SELECT c, d FROM t2 WHERE c = 1 AND c <> 1 );
+a b
+1 NULL
+2 NULL
+SELECT * FROM t1 WHERE b NOT IN ( SELECT c FROM t2 WHERE c = 1 );
+a b
+1 NULL
+2 NULL
+SELECT * FROM t1 WHERE NULL NOT IN ( SELECT c FROM t2 WHERE c = 1 AND c <> 1 );
+a b
+1 NULL
+2 NULL
+DROP TABLE t1, t2, t3, t4, t5;
#
# End of 5.1 tests.
#