summaryrefslogtreecommitdiff
path: root/mysql-test
diff options
context:
space:
mode:
authorgshchepa/uchum@host.loc <>2008-04-23 02:27:23 +0500
committergshchepa/uchum@host.loc <>2008-04-23 02:27:23 +0500
commita0c5b495cb25af8154850519e55c11c024414af3 (patch)
treeaabf58dec7cdd1b951b6c9d378efa2e54c68ac84 /mysql-test
parentdc01e1d612d8526fe94939a37818993e4cd15f29 (diff)
downloadmariadb-git-a0c5b495cb25af8154850519e55c11c024414af3.tar.gz
Fixed bug#36005: server crashes inside NOT IN clause subquery with
impossible WHERE/HAVING clause (subselect_single_select_engine::exec). Allocation and initialization of joined table list t1, t2... of subqueries like: NOT IN (SELECT ... FROM t1,t2,... WHERE 0) is optimized out, however server tries to traverse this list.
Diffstat (limited to 'mysql-test')
-rw-r--r--mysql-test/r/subselect3.result9
-rw-r--r--mysql-test/t/subselect3.test13
2 files changed, 22 insertions, 0 deletions
diff --git a/mysql-test/r/subselect3.result b/mysql-test/r/subselect3.result
index c194ba33756..5221fa09744 100644
--- a/mysql-test/r/subselect3.result
+++ b/mysql-test/r/subselect3.result
@@ -770,4 +770,13 @@ SELECT ROW(1, 2) IN (SELECT t1.a, 2 FROM t2) FROM t1 GROUP BY t1.a;
ROW(1, 2) IN (SELECT t1.a, 2 FROM t2)
1
DROP TABLE t1, t2;
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+CREATE TABLE t2 SELECT * FROM t1;
+SELECT 1 FROM t1 WHERE t1.a NOT IN (SELECT 1 FROM t1, t2 WHERE 0);
+1
+1
+1
+1
+DROP TABLE t1, t2;
End of 5.0 tests
diff --git a/mysql-test/t/subselect3.test b/mysql-test/t/subselect3.test
index cfbde8c29cd..d7bb1f7186a 100644
--- a/mysql-test/t/subselect3.test
+++ b/mysql-test/t/subselect3.test
@@ -605,4 +605,17 @@ SELECT ROW(1, 2) IN (SELECT t1.a, 2 FROM t2) FROM t1 GROUP BY t1.a;
DROP TABLE t1, t2;
+#
+# Bug #36005: crash in subselect with single row
+# (subselect_single_select_engine::exec)
+#
+
+CREATE TABLE t1 (a INT);
+INSERT INTO t1 VALUES (1),(2),(3);
+CREATE TABLE t2 SELECT * FROM t1;
+
+SELECT 1 FROM t1 WHERE t1.a NOT IN (SELECT 1 FROM t1, t2 WHERE 0);
+
+DROP TABLE t1, t2;
+
--echo End of 5.0 tests