summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorigor@rurik.mysql.com <>2006-10-20 09:26:01 -0700
committerigor@rurik.mysql.com <>2006-10-20 09:26:01 -0700
commitc6663c32db4b2061fc825d51febb5ea6c62dbaa4 (patch)
treeb5e852d3690e97723c00f142ef6c8b6054451c77 /mysql-test
parentc77fae407b0ed423daace82044fc034f3c6c43ff (diff)
parentd8b6f46a390951d3da038bd366b38760ae5a38c9 (diff)
downloadmariadb-git-c6663c32db4b2061fc825d51febb5ea6c62dbaa4.tar.gz
Merge rurik.mysql.com:/home/igor/mysql-4.1-opt
into rurik.mysql.com:/home/igor/mysql-5.0-opt
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/subselect.result15
-rw-r--r--mysql-test/t/subselect.test17
2 files changed, 32 insertions, 0 deletions
diff --git a/mysql-test/r/subselect.result b/mysql-test/r/subselect.result
index 57d6199675d..55d48030a07 100644
--- a/mysql-test/r/subselect.result
+++ b/mysql-test/r/subselect.result
@@ -3002,6 +3002,21 @@ field1 field2
1 1
1 3
DROP TABLE t1, t2;
+CREATE TABLE t1(a int, INDEX (a));
+INSERT INTO t1 VALUES (1), (3), (5), (7);
+INSERT INTO t1 VALUES (NULL);
+CREATE TABLE t2(a int);
+INSERT INTO t2 VALUES (1),(2),(3);
+EXPLAIN SELECT a, a IN (SELECT a FROM t1) FROM t2;
+id select_type table type possible_keys key key_len ref rows Extra
+1 PRIMARY t2 ALL NULL NULL NULL NULL 3
+2 DEPENDENT SUBQUERY t1 index_subquery a a 5 func 2 Using index
+SELECT a, a IN (SELECT a FROM t1) FROM t2;
+a a IN (SELECT a FROM t1)
+1 1
+2 NULL
+3 1
+DROP TABLE t1,t2;
create table t1 (df decimal(5,1));
insert into t1 values(1.1);
insert into t1 values(2.2);
diff --git a/mysql-test/t/subselect.test b/mysql-test/t/subselect.test
index 6d5082c360b..29316e6e6a0 100644
--- a/mysql-test/t/subselect.test
+++ b/mysql-test/t/subselect.test
@@ -1955,6 +1955,23 @@ SELECT field1, field2
DROP TABLE t1, t2;
+#
+# Bug #23478: not top-level IN subquery returning a non-empty result set
+# with possible NULL values by index access from the outer query
+#
+
+CREATE TABLE t1(a int, INDEX (a));
+INSERT INTO t1 VALUES (1), (3), (5), (7);
+INSERT INTO t1 VALUES (NULL);
+
+CREATE TABLE t2(a int);
+INSERT INTO t2 VALUES (1),(2),(3);
+
+EXPLAIN SELECT a, a IN (SELECT a FROM t1) FROM t2;
+SELECT a, a IN (SELECT a FROM t1) FROM t2;
+
+DROP TABLE t1,t2;
+
# End of 4.1 tests
#