summaryrefslogtreecommitdiff
path: root/mysql-test/t/subselect3.test
diff options
context:
space:
mode:
authorGleb Shchepa <gshchepa@mysql.com>2008-10-10 15:27:58 +0500
committerGleb Shchepa <gshchepa@mysql.com>2008-10-10 15:27:58 +0500
commit27f4c34beba6c3c33f18cf7c2772d81200115d0e (patch)
tree7307f89414a3d9aeee951ad16f92aff11dd9a890 /mysql-test/t/subselect3.test
parente7520c4b7ea7f4303f250636c37133be8237a2ac (diff)
downloadmariadb-git-27f4c34beba6c3c33f18cf7c2772d81200115d0e.tar.gz
Bug #37894: Assertion in init_read_record_seq in handler.h line 1444
Select with a "NULL NOT IN" condition containing complex subselect from the same table as in the outer select failed with an assertion. The failure was caused by a concatenation of circumstances: 1) an inner select was optimized by make_join_statistics to use the QUICK_RANGE_SELECT access method (that implies an index scan of the table); 2) a subselect was independent (constant) from the outer select; 3) a condition was pushed down into inner select. During the evaluation of a constant IN expression an optimizer temporary changed the access method from index scan to table scan, but an engine handler was already initialized for index access by make_join_statistics. That caused an assertion. Unnecessary index initialization has been removed from the QUICK_RANGE_SELECT::init method (QUICK_RANGE_SELECT::reset reinvokes this initialization).
Diffstat (limited to 'mysql-test/t/subselect3.test')
-rw-r--r--mysql-test/t/subselect3.test22
1 files changed, 22 insertions, 0 deletions
diff --git a/mysql-test/t/subselect3.test b/mysql-test/t/subselect3.test
index d7bb1f7186a..7e9aa1554c0 100644
--- a/mysql-test/t/subselect3.test
+++ b/mysql-test/t/subselect3.test
@@ -618,4 +618,26 @@ SELECT 1 FROM t1 WHERE t1.a NOT IN (SELECT 1 FROM t1, t2 WHERE 0);
DROP TABLE t1, t2;
+#
+# Bug #37894: Assertion in init_read_record_seq in handler.h line 1444
+#
+
+CREATE TABLE t1 (
+ pk INT PRIMARY KEY,
+ int_key INT,
+ varchar_key VARCHAR(5) UNIQUE,
+ varchar_nokey VARCHAR(5)
+);
+INSERT INTO t1 VALUES (9, 7,NULL,NULL), (10,8,'p' ,'p');
+
+SELECT varchar_nokey
+FROM t1
+WHERE NULL NOT IN (
+ SELECT INNR.pk FROM t1 AS INNR2
+ LEFT JOIN t1 AS INNR ON ( INNR2.int_key = INNR.int_key )
+ WHERE INNR.varchar_key > 'n{'
+);
+
+DROP TABLE t1;
+
--echo End of 5.0 tests